-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] API 버저닝을 위한 ACTargetType 구현, 리뷰 API 수정 (#242) #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b1e8428
[Add,Feat] ApiVersionType 구현 및 utilPath 리팩토링 (#242)
yurim830 8eadf7c
[Chore] 추천 검색어 목록 조회 API 수정 (#242)
yurim830 8df52fb
[Chore] 리뷰 작성 시 위치 인증 API 수정 (#242)
yurim830 714cafd
[Refactor] API 버저닝을 위한 ACTargetType 프로토콜 구현 (#242)
yurim830 98a1eaf
[Chore] 리뷰 작성 API 수정 (#242)
yurim830 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // | ||
| // ApiVersionProtocol.swift | ||
| // ACON-iOS | ||
| // | ||
| // Created by 김유림 on 8/5/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Moya | ||
|
|
||
| // MARK: - Protocol | ||
|
|
||
| protocol ACTargetType: TargetType { | ||
|
|
||
| var apiVersion: ApiVersionType { get } | ||
|
|
||
| } | ||
|
|
||
|
|
||
| // MARK: - Extension | ||
|
|
||
| extension ACTargetType { | ||
|
|
||
| var baseURL: URL { | ||
| guard let urlString = Bundle.main.object(forInfoDictionaryKey: Config.Keys.Plist.baseURL) as? String, | ||
| let url = URL(string: urlString) else { | ||
| fatalError("💢💢 BASE_URL이 없음 💢💢") | ||
| } | ||
| return url | ||
| } | ||
|
|
||
| /// API 버전 기본값 (.v1). 필요 시 각 TargetType에서 오버라이드하여 변경 가능. | ||
| var apiVersion: ApiVersionType { | ||
| return .v1 | ||
| } | ||
|
|
||
| var utilPath: String { | ||
| return apiVersion.utilPath | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // | ||
| // APIVersionType.swift | ||
| // ACON-iOS | ||
| // | ||
| // Created by 김유림 on 8/5/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| enum ApiVersionType: String { | ||
|
|
||
| case v1 | ||
| case v2 | ||
|
|
||
| var utilPath: String { | ||
| return "api/\(self.rawValue)/" | ||
| } | ||
|
|
||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,6 @@ import Foundation | |
|
|
||
| struct GetReviewVerificationResponse: Codable { | ||
|
|
||
| let success: Bool | ||
| let available: Bool | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐿️🐿️🐿️
굳이 ACTargetType을 따로 만드신 이유가 있나요?? 기존 TargetType+에서 apiVersion을 선언했어도 필요한 경우만 오버라이딩하면 돼서 불필요하다고 생각합니다..!
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b1e8428 에서 처음에 그렇게 구현했었는데,
코드를 호출해보니
protocol extension의 기본 구현은 오버라이딩이 안 되며,
가능하게 하려면 따로 프로토콜을 구현해야함을 알게 되었습니다. (참고)
오버라이딩을 포기하고 각각의 TargetType 내에서
아래처럼 손수 utilPath를 구현하자니 확장성이 너무 떨어져서,
위 코드처럼 ACTargetType 프로토콜을 만들게 되었습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다 !!!!