From 30de5d6aa12d995e95b2c6aca2ebd115e3ef8a7a Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 16:33:06 +0900 Subject: [PATCH 1/9] =?UTF-8?q?[Add]=20#52=20-=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=ED=86=B5=EC=8B=A0=20=EA=B8=B0=EC=B4=88=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 16 +++++++++--- .../Runnect-iOS/Network/Foundation/.gitkeep | 0 .../Network/Foundation/BaseResponse.swift | 19 ++++++++++++++ .../Network/Foundation/NetworkHelper.swift | 26 +++++++++++++++++++ .../Network/Foundation/NetworkResult.swift | 16 ++++++++++++ 5 files changed, 74 insertions(+), 3 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Network/Foundation/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Foundation/BaseResponse.swift create mode 100644 Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift create mode 100644 Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index a0f0103a..7437c5dc 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -18,10 +18,10 @@ A3BC2F3D296468E500198261 /* UploadedCourseInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F3C296468E500198261 /* UploadedCourseInfoModel.swift */; }; A3BC2F3F2964706100198261 /* UploadedCourseInfoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F3E2964706100198261 /* UploadedCourseInfoCVC.swift */; }; A3BC2F4129667A0D00198261 /* NicknameEditorVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F4029667A0D00198261 /* NicknameEditorVC.swift */; }; + A3BC2F432966A93100198261 /* CourseDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F422966A93100198261 /* CourseDetailVC.swift */; }; CE0C23742966D62A00B45063 /* PagedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0C23732966D62A00B45063 /* PagedView.swift */; }; CE0C23772966D64D00B45063 /* PageCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0C23762966D64D00B45063 /* PageCVC.swift */; }; CE0C23792966D6AF00B45063 /* ViewPager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0C23782966D6AF00B45063 /* ViewPager.swift */; }; - A3BC2F432966A93100198261 /* CourseDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F422966A93100198261 /* CourseDetailVC.swift */; }; CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */; }; CE146770296568DC00DCEA1B /* RunTrackingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */; }; CE14677829658C7200DCEA1B /* Stopwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14677729658C7200DCEA1B /* Stopwatch.swift */; }; @@ -36,6 +36,9 @@ CE29D582296402B500F47542 /* CourseDrawingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE29D581296402B500F47542 /* CourseDrawingVC.swift */; }; CE29D584296416D800F47542 /* caculateStatusBarHeight.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE29D583296416D800F47542 /* caculateStatusBarHeight.swift */; }; CE40BB1C2967E4910030ABCA /* RunningWaitingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB1B2967E4910030ABCA /* RunningWaitingVC.swift */; }; + CE40BB1E2968054F0030ABCA /* BaseResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB1D2968054F0030ABCA /* BaseResponse.swift */; }; + CE40BB20296805F70030ABCA /* NetworkResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB1F296805F70030ABCA /* NetworkResult.swift */; }; + CE40BB22296806140030ABCA /* NetworkHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB21296806140030ABCA /* NetworkHelper.swift */; }; CE4545C9295D7AF4003201E1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4545C8295D7AF4003201E1 /* AppDelegate.swift */; }; CE4545CB295D7AF4003201E1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4545CA295D7AF4003201E1 /* SceneDelegate.swift */; }; CE4545CD295D7AF4003201E1 /* TaBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4545CC295D7AF4003201E1 /* TaBarController.swift */; }; @@ -148,6 +151,9 @@ CE29D581296402B500F47542 /* CourseDrawingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDrawingVC.swift; sourceTree = ""; }; CE29D583296416D800F47542 /* caculateStatusBarHeight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = caculateStatusBarHeight.swift; sourceTree = ""; }; CE40BB1B2967E4910030ABCA /* RunningWaitingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunningWaitingVC.swift; sourceTree = ""; }; + CE40BB1D2968054F0030ABCA /* BaseResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseResponse.swift; sourceTree = ""; }; + CE40BB1F296805F70030ABCA /* NetworkResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkResult.swift; sourceTree = ""; }; + CE40BB21296806140030ABCA /* NetworkHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkHelper.swift; sourceTree = ""; }; CE4545C5295D7AF4003201E1 /* Runnect-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Runnect-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; CE4545C8295D7AF4003201E1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; CE4545CA295D7AF4003201E1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -161,7 +167,6 @@ CE5875A1296015A2005D967E /* NetworkLoggerPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkLoggerPlugin.swift; sourceTree = ""; }; CE5875A3296015D2005D967E /* Encodable+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+.swift"; sourceTree = ""; }; CE6655BC295D82CF00C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; - CE6655BD295D82D800C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655BE295D82E200C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C0295D82F000C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C1295D82F700C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; @@ -627,8 +632,10 @@ CE6655AF295D7FF600C64E12 /* Foundation */ = { isa = PBXGroup; children = ( - CE6655BD295D82D800C64E12 /* .gitkeep */, CE5875A1296015A2005D967E /* NetworkLoggerPlugin.swift */, + CE40BB1D2968054F0030ABCA /* BaseResponse.swift */, + CE40BB1F296805F70030ABCA /* NetworkResult.swift */, + CE40BB21296806140030ABCA /* NetworkHelper.swift */, ); path = Foundation; sourceTree = ""; @@ -983,6 +990,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CE40BB20296805F70030ABCA /* NetworkResult.swift in Sources */, CE665604295D91B100C64E12 /* makeAlert.swift in Sources */, A3BC2F2F2962C40A00198261 /* UploadedCourseInfoVC.swift in Sources */, CE6655EA295D88B200C64E12 /* UITabBar+.swift in Sources */, @@ -992,6 +1000,7 @@ CE4545CD295D7AF4003201E1 /* TaBarController.swift in Sources */, CE6655F4295D898400C64E12 /* UIViewController+.swift in Sources */, CE14677829658C7200DCEA1B /* Stopwatch.swift in Sources */, + CE40BB22296806140030ABCA /* NetworkHelper.swift in Sources */, CE5645162961B72E000A2856 /* ImageLiterals.swift in Sources */, CE6655CD295D856300C64E12 /* KeyPathFindable.swift in Sources */, CE29D582296402B500F47542 /* CourseDrawingVC.swift in Sources */, @@ -1018,6 +1027,7 @@ CE6655E8295D889600C64E12 /* UISwitch+.swift in Sources */, CE0C23772966D64D00B45063 /* PageCVC.swift in Sources */, CE5875A029601500005D967E /* Toast.swift in Sources */, + CE40BB1E2968054F0030ABCA /* BaseResponse.swift in Sources */, CE14677C2965C1B100DCEA1B /* RunningRecordVC.swift in Sources */, CE6B63D829673450003F900F /* ListEmptyView.swift in Sources */, CE6655F6295D90B600C64E12 /* addToolBar.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Foundation/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/BaseResponse.swift b/Runnect-iOS/Runnect-iOS/Network/Foundation/BaseResponse.swift new file mode 100644 index 00000000..5b278994 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Foundation/BaseResponse.swift @@ -0,0 +1,19 @@ +// +// BaseResponse.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +struct BaseResponse: Codable { + let status: Int + let success: Bool + let message: String + let data: T? +} + +/// data가 없는 API 통신에서 사용할 BlankData 구조체 +struct BlankData: Codable { +} diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift new file mode 100644 index 00000000..b67a34c3 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift @@ -0,0 +1,26 @@ +// +// NetworkHelper.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +struct NetworkHelper { + private init() {} + + // 상태 코드와 데이터, decoding type을 가지고 통신의 결과를 핸들링하는 함수 + static func parseJSON (by statusCode: Int, data: Data, type: T.Type) -> NetworkResult { + let decoder = JSONDecoder() + + guard let decodedData = try? decoder.decode(BaseResponse.self, from: data) else { return .pathErr("pathErr") } + + switch statusCode { + case 200..<300: return .success(decodedData.data as Any) + case 400..<500: return .requestErr(decodedData.data as Any) + case 500..<600: return .serverErr + default: return .networkFail + } + } +} diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift new file mode 100644 index 00000000..2990a585 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift @@ -0,0 +1,16 @@ +// +// NetworkResult.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +enum NetworkResult { + case success(T) // 서버 통신 성공했을 때 + case requestErr(T) // 요청 에러 발생했을 때 + case pathErr(T) // 경로 에러 발생했을 때 + case serverErr // 서버의 내부 에러가 발생했을 때 + case networkFail // 네트워크 연결 실패했을 때 +} From b9f0e430c4fe5e90a741963d99b7e0b4915b38f7 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 16:34:03 +0900 Subject: [PATCH 2/9] =?UTF-8?q?[Chore]=20#52=20-=20.gitignore=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 33136889..61c0b1db 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,4 @@ iOSInjectionProject/ # End of https://www.toptal.com/developers/gitignore/api/xcode,swift,cocoapods .DS_Store +Config.swift From eec754d7f888bffe9ab2dc60aac4d938f4908a0d Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 16:53:04 +0900 Subject: [PATCH 3/9] =?UTF-8?q?[Feat]=20#52=20-=20DepartureSearchingRouter?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 64 +++++++++++++++++++ .../DepartureSearchingRouter.swift | 50 +++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 7437c5dc..2451dd5c 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -39,6 +39,8 @@ CE40BB1E2968054F0030ABCA /* BaseResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB1D2968054F0030ABCA /* BaseResponse.swift */; }; CE40BB20296805F70030ABCA /* NetworkResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB1F296805F70030ABCA /* NetworkResult.swift */; }; CE40BB22296806140030ABCA /* NetworkHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB21296806140030ABCA /* NetworkHelper.swift */; }; + CE40BB242968068E0030ABCA /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB232968068E0030ABCA /* Config.swift */; }; + CE40BB2D296808B00030ABCA /* DepartureSearchingRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE40BB2C296808B00030ABCA /* DepartureSearchingRouter.swift */; }; CE4545C9295D7AF4003201E1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4545C8295D7AF4003201E1 /* AppDelegate.swift */; }; CE4545CB295D7AF4003201E1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4545CA295D7AF4003201E1 /* SceneDelegate.swift */; }; CE4545CD295D7AF4003201E1 /* TaBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4545CC295D7AF4003201E1 /* TaBarController.swift */; }; @@ -154,6 +156,8 @@ CE40BB1D2968054F0030ABCA /* BaseResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseResponse.swift; sourceTree = ""; }; CE40BB1F296805F70030ABCA /* NetworkResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkResult.swift; sourceTree = ""; }; CE40BB21296806140030ABCA /* NetworkHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkHelper.swift; sourceTree = ""; }; + CE40BB232968068E0030ABCA /* Config.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; + CE40BB2C296808B00030ABCA /* DepartureSearchingRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepartureSearchingRouter.swift; sourceTree = ""; }; CE4545C5295D7AF4003201E1 /* Runnect-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Runnect-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; CE4545C8295D7AF4003201E1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; CE4545CA295D7AF4003201E1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -525,6 +529,56 @@ path = Views; sourceTree = ""; }; + CE40BB25296807FC0030ABCA /* SignInRouter */ = { + isa = PBXGroup; + children = ( + ); + path = SignInRouter; + sourceTree = ""; + }; + CE40BB26296808020030ABCA /* CourseDrawingRouter */ = { + isa = PBXGroup; + children = ( + CE40BB2C296808B00030ABCA /* DepartureSearchingRouter.swift */, + ); + path = CourseDrawingRouter; + sourceTree = ""; + }; + CE40BB27296808290030ABCA /* CourseStorageRouter */ = { + isa = PBXGroup; + children = ( + ); + path = CourseStorageRouter; + sourceTree = ""; + }; + CE40BB28296808300030ABCA /* CourseDiscoveryRouter */ = { + isa = PBXGroup; + children = ( + ); + path = CourseDiscoveryRouter; + sourceTree = ""; + }; + CE40BB292968083B0030ABCA /* MyPageRouter */ = { + isa = PBXGroup; + children = ( + ); + path = MyPageRouter; + sourceTree = ""; + }; + CE40BB2A296808440030ABCA /* CourseDetailRouter */ = { + isa = PBXGroup; + children = ( + ); + path = CourseDetailRouter; + sourceTree = ""; + }; + CE40BB2B296808500030ABCA /* RunningRouter */ = { + isa = PBXGroup; + children = ( + ); + path = RunningRouter; + sourceTree = ""; + }; CE4545BC295D7AF4003201E1 = { isa = PBXGroup; children = ( @@ -616,6 +670,13 @@ CE6655AD295D7FEA00C64E12 /* Router */ = { isa = PBXGroup; children = ( + CE40BB25296807FC0030ABCA /* SignInRouter */, + CE40BB26296808020030ABCA /* CourseDrawingRouter */, + CE40BB27296808290030ABCA /* CourseStorageRouter */, + CE40BB28296808300030ABCA /* CourseDiscoveryRouter */, + CE40BB292968083B0030ABCA /* MyPageRouter */, + CE40BB2A296808440030ABCA /* CourseDetailRouter */, + CE40BB2B296808500030ABCA /* RunningRouter */, CE6655C0295D82F000C64E12 /* .gitkeep */, ); path = Router; @@ -636,6 +697,7 @@ CE40BB1D2968054F0030ABCA /* BaseResponse.swift */, CE40BB1F296805F70030ABCA /* NetworkResult.swift */, CE40BB21296806140030ABCA /* NetworkHelper.swift */, + CE40BB232968068E0030ABCA /* Config.swift */, ); path = Foundation; sourceTree = ""; @@ -1023,6 +1085,7 @@ CEEC6B3E2961C53700D00E1E /* CourseDiscoveryVC.swift in Sources */, DA20D8452966979100F1581F /* DiscoveryDetailViewController.swift in Sources */, CE6655E0295D87D200C64E12 /* UIDevice+.swift in Sources */, + CE40BB242968068E0030ABCA /* Config.swift in Sources */, CE17F0382961BF8B00E1DED0 /* FontLiterals.swift in Sources */, CE6655E8295D889600C64E12 /* UISwitch+.swift in Sources */, CE0C23772966D64D00B45063 /* PageCVC.swift in Sources */, @@ -1079,6 +1142,7 @@ CE0C23742966D62A00B45063 /* PagedView.swift in Sources */, CE14677A2965A80700DCEA1B /* CustomBottomSheetVC.swift in Sources */, CEEC6B4B2961D89700D00E1E /* CustomNavigationBar.swift in Sources */, + CE40BB2D296808B00030ABCA /* DepartureSearchingRouter.swift in Sources */, CE17F02D2961BBA100E1DED0 /* ColorLiterals.swift in Sources */, CEC2A68E2962AF2C00160BF7 /* RNMarker.swift in Sources */, CE6655D2295D862A00C64E12 /* Publisher+Driver.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift new file mode 100644 index 00000000..66adaa76 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift @@ -0,0 +1,50 @@ +// +// DepartureSearchingRouter.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +import Moya + +enum DepartureSearchingRouter { + case getAddress(keyword: String) +} + +extension DepartureSearchingRouter: TargetType { + var baseURL: URL { + guard let url = URL(string: Config.kakaoAddressBaseURL) else { + fatalError("baseURL could not be configured") + } + + return url + } + + var path: String { + switch self { + case .getAddress: + return "/keyword.json" + } + } + + var method: Moya.Method { + switch self { + case .getAddress: + return .get + } + } + + var task: Moya.Task { + switch self { + case .getAddress(let keyword): + return .requestParameters(parameters: ["query": keyword], encoding: URLEncoding.default) + } + } + + var headers: [String : String]? { + return ["Content-Type": "application/json", + "Authorization": "KakaoAK \(Config.kakaoRestAPIKey)"] + } +} From 394041f9c871aabde385763990916b79cc5a3c0c Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 17:04:29 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[Add]=20#52=20-=20=EB=84=A4=ED=8A=B8?= =?UTF-8?q?=EC=9B=8C=ED=82=B9=20=ED=86=B5=EC=8B=A0=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=ED=8F=B4=EB=8D=94=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 154 +++++++++++++++++- .../Dto/{ => CourseDetailDto}/.gitkeep | 0 .../Network/Dto/CourseDiscoveryDto/.gitkeep | 0 .../Network/Dto/CourseDrawingDto/.gitkeep | 0 .../Network/Dto/CourseStorageDto/.gitkeep | 0 .../Network/Dto/MyPageDto/.gitkeep | 0 .../Network/Dto/RunningDto/.gitkeep | 0 .../Network/Dto/SignInDto/.gitkeep | 0 .../Network/Model/CourseDetailModel/.gitkeep | 0 .../Model/CourseDiscoveryModel/.gitkeep | 0 .../Network/Model/CourseDrawingModel/.gitkeep | 0 .../Network/Model/CourseStorageModel/.gitkeep | 0 .../Network/Model/MyPageModel/.gitkeep | 0 .../Network/Model/RunningModel/.gitkeep | 0 .../Network/Model/SignInModel/.gitkeep | 0 .../Router/CourseDetailRouter/.gitkeep | 0 .../Router/CourseDiscoveryRouter/.gitkeep | 0 .../Router/CourseStorageRouter/.gitkeep | 0 .../Network/Router/MyPageRouter/.gitkeep | 0 .../Network/Router/RunningRouter/.gitkeep | 0 .../Network/Router/SignInRouter/.gitkeep | 0 21 files changed, 152 insertions(+), 2 deletions(-) rename Runnect-iOS/Runnect-iOS/Network/Dto/{ => CourseDetailDto}/.gitkeep (100%) create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/RunningDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/CourseDetailModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/CourseDiscoveryModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/CourseStorageModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/MyPageModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/RunningModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/SignInModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/CourseDetailRouter/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/CourseDiscoveryRouter/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/CourseStorageRouter/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/MyPageRouter/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/RunningRouter/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Router/SignInRouter/.gitkeep diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 2451dd5c..d141208d 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -140,6 +140,26 @@ CE0C23762966D64D00B45063 /* PageCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageCVC.swift; sourceTree = ""; }; CE0C23782966D6AF00B45063 /* ViewPager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewPager.swift; sourceTree = ""; }; CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertVC.swift; sourceTree = ""; }; + CE10063929680C5700FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10063A29680C6100FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10063B29680C6800FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10063C29680C7000FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10063D29680C8100FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10063E29680C8800FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10063F29680C9800FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064029680C9F00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064129680CA700FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064229680CAD00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064329680CB400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064429680CBC00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064529680CC300FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064D29680D2500FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064E29680D2C00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10064F29680D3300FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10065029680D3800FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10065129680D3F00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10065229680D4400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10065329680D5400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunTrackingVC.swift; sourceTree = ""; }; CE14677729658C7200DCEA1B /* Stopwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stopwatch.swift; sourceTree = ""; }; CE1467792965A80700DCEA1B /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; @@ -170,7 +190,6 @@ CE58759F29601500005D967E /* Toast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = ""; }; CE5875A1296015A2005D967E /* NetworkLoggerPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkLoggerPlugin.swift; sourceTree = ""; }; CE5875A3296015D2005D967E /* Encodable+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+.swift"; sourceTree = ""; }; - CE6655BC295D82CF00C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655BE295D82E200C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C0295D82F000C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C1295D82F700C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; @@ -345,6 +364,118 @@ path = CVC; sourceTree = ""; }; + CE10063229680BEB00FD31FB /* RunningDto */ = { + isa = PBXGroup; + children = ( + CE10063F29680C9800FD31FB /* .gitkeep */, + ); + path = RunningDto; + sourceTree = ""; + }; + CE10063329680BFD00FD31FB /* CourseDetailDto */ = { + isa = PBXGroup; + children = ( + CE10063E29680C8800FD31FB /* .gitkeep */, + ); + path = CourseDetailDto; + sourceTree = ""; + }; + CE10063429680C0800FD31FB /* MyPageDto */ = { + isa = PBXGroup; + children = ( + CE10063D29680C8100FD31FB /* .gitkeep */, + ); + path = MyPageDto; + sourceTree = ""; + }; + CE10063529680C0F00FD31FB /* CourseDiscoveryDto */ = { + isa = PBXGroup; + children = ( + CE10063C29680C7000FD31FB /* .gitkeep */, + ); + path = CourseDiscoveryDto; + sourceTree = ""; + }; + CE10063629680C1C00FD31FB /* CourseStorageDto */ = { + isa = PBXGroup; + children = ( + CE10063B29680C6800FD31FB /* .gitkeep */, + ); + path = CourseStorageDto; + sourceTree = ""; + }; + CE10063729680C2400FD31FB /* CourseDrawingDto */ = { + isa = PBXGroup; + children = ( + CE10063A29680C6100FD31FB /* .gitkeep */, + ); + path = CourseDrawingDto; + sourceTree = ""; + }; + CE10063829680C2A00FD31FB /* SignInDto */ = { + isa = PBXGroup; + children = ( + CE10063929680C5700FD31FB /* .gitkeep */, + ); + path = SignInDto; + sourceTree = ""; + }; + CE10064629680CE600FD31FB /* RunningModel */ = { + isa = PBXGroup; + children = ( + CE10065329680D5400FD31FB /* .gitkeep */, + ); + path = RunningModel; + sourceTree = ""; + }; + CE10064729680CED00FD31FB /* CourseDetailModel */ = { + isa = PBXGroup; + children = ( + CE10065229680D4400FD31FB /* .gitkeep */, + ); + path = CourseDetailModel; + sourceTree = ""; + }; + CE10064829680CF200FD31FB /* MyPageModel */ = { + isa = PBXGroup; + children = ( + CE10065129680D3F00FD31FB /* .gitkeep */, + ); + path = MyPageModel; + sourceTree = ""; + }; + CE10064929680CF800FD31FB /* CourseDiscoveryModel */ = { + isa = PBXGroup; + children = ( + CE10065029680D3800FD31FB /* .gitkeep */, + ); + path = CourseDiscoveryModel; + sourceTree = ""; + }; + CE10064A29680D0200FD31FB /* CourseStorageModel */ = { + isa = PBXGroup; + children = ( + CE10064F29680D3300FD31FB /* .gitkeep */, + ); + path = CourseStorageModel; + sourceTree = ""; + }; + CE10064B29680D0900FD31FB /* CourseDrawingModel */ = { + isa = PBXGroup; + children = ( + CE10064E29680D2C00FD31FB /* .gitkeep */, + ); + path = CourseDrawingModel; + sourceTree = ""; + }; + CE10064C29680D1700FD31FB /* SignInModel */ = { + isa = PBXGroup; + children = ( + CE10064D29680D2500FD31FB /* .gitkeep */, + ); + path = SignInModel; + sourceTree = ""; + }; CE14676C296568C000DCEA1B /* Running */ = { isa = PBXGroup; children = ( @@ -532,6 +663,7 @@ CE40BB25296807FC0030ABCA /* SignInRouter */ = { isa = PBXGroup; children = ( + CE10064029680C9F00FD31FB /* .gitkeep */, ); path = SignInRouter; sourceTree = ""; @@ -547,6 +679,7 @@ CE40BB27296808290030ABCA /* CourseStorageRouter */ = { isa = PBXGroup; children = ( + CE10064129680CA700FD31FB /* .gitkeep */, ); path = CourseStorageRouter; sourceTree = ""; @@ -554,6 +687,7 @@ CE40BB28296808300030ABCA /* CourseDiscoveryRouter */ = { isa = PBXGroup; children = ( + CE10064229680CAD00FD31FB /* .gitkeep */, ); path = CourseDiscoveryRouter; sourceTree = ""; @@ -561,6 +695,7 @@ CE40BB292968083B0030ABCA /* MyPageRouter */ = { isa = PBXGroup; children = ( + CE10064329680CB400FD31FB /* .gitkeep */, ); path = MyPageRouter; sourceTree = ""; @@ -568,6 +703,7 @@ CE40BB2A296808440030ABCA /* CourseDetailRouter */ = { isa = PBXGroup; children = ( + CE10064429680CBC00FD31FB /* .gitkeep */, ); path = CourseDetailRouter; sourceTree = ""; @@ -575,6 +711,7 @@ CE40BB2B296808500030ABCA /* RunningRouter */ = { isa = PBXGroup; children = ( + CE10064529680CC300FD31FB /* .gitkeep */, ); path = RunningRouter; sourceTree = ""; @@ -662,6 +799,13 @@ CE6655AC295D7FE400C64E12 /* Model */ = { isa = PBXGroup; children = ( + CE10064C29680D1700FD31FB /* SignInModel */, + CE10064B29680D0900FD31FB /* CourseDrawingModel */, + CE10064A29680D0200FD31FB /* CourseStorageModel */, + CE10064929680CF800FD31FB /* CourseDiscoveryModel */, + CE10064829680CF200FD31FB /* MyPageModel */, + CE10064729680CED00FD31FB /* CourseDetailModel */, + CE10064629680CE600FD31FB /* RunningModel */, CE6655C1295D82F700C64E12 /* .gitkeep */, ); path = Model; @@ -705,7 +849,13 @@ CE6655B0295D800700C64E12 /* Dto */ = { isa = PBXGroup; children = ( - CE6655BC295D82CF00C64E12 /* .gitkeep */, + CE10063829680C2A00FD31FB /* SignInDto */, + CE10063729680C2400FD31FB /* CourseDrawingDto */, + CE10063629680C1C00FD31FB /* CourseStorageDto */, + CE10063529680C0F00FD31FB /* CourseDiscoveryDto */, + CE10063429680C0800FD31FB /* MyPageDto */, + CE10063329680BFD00FD31FB /* CourseDetailDto */, + CE10063229680BEB00FD31FB /* RunningDto */, ); path = Dto; sourceTree = ""; diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDetailDto/.gitkeep similarity index 100% rename from Runnect-iOS/Runnect-iOS/Network/Dto/.gitkeep rename to Runnect-iOS/Runnect-iOS/Network/Dto/CourseDetailDto/.gitkeep diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseStorageDto/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/RunningDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/RunningDto/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/CourseDetailModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/CourseDetailModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/CourseDiscoveryModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/CourseDiscoveryModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/CourseStorageModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/CourseStorageModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/MyPageModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/MyPageModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/RunningModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/RunningModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/SignInModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/SignInModel/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDetailRouter/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDetailRouter/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDiscoveryRouter/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDiscoveryRouter/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseStorageRouter/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Router/CourseStorageRouter/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/MyPageRouter/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Router/MyPageRouter/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/RunningRouter/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Router/RunningRouter/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/SignInRouter/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Router/SignInRouter/.gitkeep new file mode 100644 index 00000000..e69de29b From 08741511c70a64e2ce3eed87b5635781bd3af6d6 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 17:55:45 +0900 Subject: [PATCH 5/9] =?UTF-8?q?[Feat]=20#52=20-=20=EC=B6=9C=EB=B0=9C?= =?UTF-8?q?=EC=A7=80=20=EA=B2=80=EC=83=89=20API=20=ED=86=B5=EC=8B=A0=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 8 ++-- .../Runnect-iOS/Global/Utils/Toast.swift | 4 ++ .../Network/Dto/CourseDrawingDto/.gitkeep | 0 .../DepartureSearchingResponseDto.swift | 34 ++++++++++++++++ .../Network/Foundation/NetworkHelper.swift | 2 + .../DepartureSearchingRouter.swift | 2 +- .../CourseDrawing/VC/DepartureSearchVC.swift | 40 ++++++++++++++++++- 7 files changed, 84 insertions(+), 6 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index d141208d..2e7533ee 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -23,6 +23,7 @@ CE0C23772966D64D00B45063 /* PageCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0C23762966D64D00B45063 /* PageCVC.swift */; }; CE0C23792966D6AF00B45063 /* ViewPager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0C23782966D6AF00B45063 /* ViewPager.swift */; }; CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */; }; + CE10065529680F7000FD31FB /* DepartureSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */; }; CE146770296568DC00DCEA1B /* RunTrackingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */; }; CE14677829658C7200DCEA1B /* Stopwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14677729658C7200DCEA1B /* Stopwatch.swift */; }; CE14677A2965A80700DCEA1B /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1467792965A80700DCEA1B /* CustomBottomSheetVC.swift */; }; @@ -141,7 +142,6 @@ CE0C23782966D6AF00B45063 /* ViewPager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewPager.swift; sourceTree = ""; }; CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertVC.swift; sourceTree = ""; }; CE10063929680C5700FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; - CE10063A29680C6100FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10063B29680C6800FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10063C29680C7000FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10063D29680C8100FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; @@ -160,6 +160,7 @@ CE10065129680D3F00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065229680D4400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065329680D5400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepartureSearchingResponseDto.swift; sourceTree = ""; }; CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunTrackingVC.swift; sourceTree = ""; }; CE14677729658C7200DCEA1B /* Stopwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stopwatch.swift; sourceTree = ""; }; CE1467792965A80700DCEA1B /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; @@ -407,7 +408,7 @@ CE10063729680C2400FD31FB /* CourseDrawingDto */ = { isa = PBXGroup; children = ( - CE10063A29680C6100FD31FB /* .gitkeep */, + CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */, ); path = CourseDrawingDto; sourceTree = ""; @@ -765,8 +766,8 @@ CE6655A9295D7FAA00C64E12 /* Network */ = { isa = PBXGroup; children = ( - CE6655B0295D800700C64E12 /* Dto */, CE6655AF295D7FF600C64E12 /* Foundation */, + CE6655B0295D800700C64E12 /* Dto */, CE6655AE295D7FF000C64E12 /* Service */, CE6655AD295D7FEA00C64E12 /* Router */, CE6655AC295D7FE400C64E12 /* Model */, @@ -1221,6 +1222,7 @@ A3BC2F2B2962C3D500198261 /* GoalRewardInfoVC.swift in Sources */, CE665606295D91C500C64E12 /* makeVibrate.swift in Sources */, CE66560A295D924A00C64E12 /* Result+.swift in Sources */, + CE10065529680F7000FD31FB /* DepartureSearchingResponseDto.swift in Sources */, DA20D847296697A600F1581F /* PlusDetailVC.swift in Sources */, CE66560E295D92A500C64E12 /* setStatusBarBackgroundColor.swift in Sources */, CE9291292965E01D0010959C /* RNTimeFormatter.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Utils/Toast.swift b/Runnect-iOS/Runnect-iOS/Global/Utils/Toast.swift index d7836d7e..6a421642 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Utils/Toast.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Utils/Toast.swift @@ -13,6 +13,10 @@ public extension UIViewController { func showToast(message: String) { Toast.show(message: message, view: self.view, safeAreaBottomInset: self.safeAreaBottomInset()) } + + func showNetworkFailureToast() { + showToast(message: "네트워크 통신 실패") + } } public class Toast { diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift new file mode 100644 index 00000000..6e33bf22 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift @@ -0,0 +1,34 @@ +// +// DepartureSearchingResponseDto.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +// MARK: - Empty +struct DepartureSearchingResponseDto: Codable { + let documents: [KakaoAddressResult] +// let meta: Meta +} + +// MARK: - Document +struct KakaoAddressResult: Codable { + let addressName, categoryGroupCode, categoryGroupName, categoryName: String + let distance, id, phone, placeName: String + let placeURL: String + let roadAddressName, x, y: String + + enum CodingKeys: String, CodingKey { + case addressName = "address_name" + case categoryGroupCode = "category_group_code" + case categoryGroupName = "category_group_name" + case categoryName = "category_name" + case distance, id, phone + case placeName = "place_name" + case placeURL = "place_url" + case roadAddressName = "road_address_name" + case x, y + } +} diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift index b67a34c3..01305906 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift @@ -7,6 +7,8 @@ import Foundation +import Moya + struct NetworkHelper { private init() {} diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift index 66adaa76..ada453b0 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift @@ -43,7 +43,7 @@ extension DepartureSearchingRouter: TargetType { } } - var headers: [String : String]? { + var headers: [String: String]? { return ["Content-Type": "application/json", "Authorization": "KakaoAK \(Config.kakaoRestAPIKey)"] } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 9e6f1ec6..c24f8339 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -7,8 +7,16 @@ import UIKit +import Moya + final class DepartureSearchVC: UIViewController { + // MARK: - Properties + + private let departureSearchingProvider = MoyaProvider( + plugins: [NetworkLoggerPlugin(verbose: true)] + ) + // MARK: - UI Components private lazy var naviBar = CustomNavigationBar(self, type: .search).setTextFieldPlaceholder(placeholder: "지역과 키워드 위주로 검색해보세요") @@ -131,7 +139,35 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { extension DepartureSearchVC: CustomNavigationBarDelegate { func searchButtonDidTap(text: String) { - print(text) - // 서버 통신 구현 + searchAddressWithKeyword(keyword: text) + } +} + +// MARK: - Network + +extension DepartureSearchVC { + private func searchAddressWithKeyword(keyword: String) { + departureSearchingProvider + .request(.getAddress(keyword: keyword)) { [weak self] response in + guard let self = self else { return } + switch response { + case .success(let result): + let status = result.statusCode + if 200..<300 ~= status { + do { + let responseDto = try result.map(DepartureSearchingResponseDto.self) + print(responseDto) + } catch { + print(error.localizedDescription) + } + } + if status >= 400 { + print("400 error") + } + case .failure(let error): + print(error.localizedDescription) + self.showToast(message: "네트워크 통신 실패") + } + } } } From a18be930e1ec16b1484eeb6b1674b564e5204f05 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 18:06:33 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[Feat]=20#52=20-=20=EC=A3=BC=EC=86=8C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20UI=20=EB=B0=94=EC=9D=B8=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DepartureSearchingResponseDto.swift | 12 +++++++----- .../CourseDrawing/VC/DepartureSearchVC.swift | 17 ++++++++++++++--- .../Views/LocationSearchResultTVC.swift | 9 +++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift index 6e33bf22..32b1edb9 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift @@ -7,18 +7,19 @@ import Foundation -// MARK: - Empty +// MARK: - DepartureSearchingResponseDto + struct DepartureSearchingResponseDto: Codable { let documents: [KakaoAddressResult] -// let meta: Meta } -// MARK: - Document +// MARK: - KakaoAddressResult + struct KakaoAddressResult: Codable { let addressName, categoryGroupCode, categoryGroupName, categoryName: String let distance, id, phone, placeName: String let placeURL: String - let roadAddressName, x, y: String + let roadAddressName, latitude, longitude: String enum CodingKeys: String, CodingKey { case addressName = "address_name" @@ -29,6 +30,7 @@ struct KakaoAddressResult: Codable { case placeName = "place_name" case placeURL = "place_url" case roadAddressName = "road_address_name" - case x, y + case longitude = "x" + case latitude = "y" } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index c24f8339..ff803688 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -17,9 +17,13 @@ final class DepartureSearchVC: UIViewController { plugins: [NetworkLoggerPlugin(verbose: true)] ) + private var addressList = [KakaoAddressResult]() + // MARK: - UI Components - private lazy var naviBar = CustomNavigationBar(self, type: .search).setTextFieldPlaceholder(placeholder: "지역과 키워드 위주로 검색해보세요") + private lazy var naviBar = CustomNavigationBar(self, type: .search) + .setTextFieldPlaceholder(placeholder: "지역과 키워드 위주로 검색해보세요") + .showKeyboard() private let dividerView = UIView().then { $0.backgroundColor = .g5 @@ -73,6 +77,12 @@ extension DepartureSearchVC { self.locationTableView.register(LocationSearchResultTVC.self, forCellReuseIdentifier: LocationSearchResultTVC.className) } + + func setData(data: [KakaoAddressResult]) { + self.addressList = data + emptyDataView.isHidden = !data.isEmpty + locationTableView.reloadData() + } } // MARK: - UI & Layout @@ -113,7 +123,7 @@ extension DepartureSearchVC { extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 5 + return addressList.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -121,6 +131,7 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { as? LocationSearchResultTVC else { return UITableViewCell() } cell.selectionStyle = .none + cell.setData(model: self.addressList[indexPath.item]) return cell } @@ -156,7 +167,7 @@ extension DepartureSearchVC { if 200..<300 ~= status { do { let responseDto = try result.map(DepartureSearchingResponseDto.self) - print(responseDto) + self.setData(data: responseDto.documents) } catch { print(error.localizedDescription) } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift index 7e2edb92..c8bfb08e 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift @@ -51,6 +51,15 @@ final class LocationSearchResultTVC: UITableViewCell { } } +// MARK: - Methods + +extension LocationSearchResultTVC { + func setData(model: KakaoAddressResult) { + self.locationLabel.text = model.placeName + self.detailLocationLabel.text = model.addressName + } +} + // MARK: - UI & Layout extension LocationSearchResultTVC { From 80ce10e20b906653662b434870c709bbf0d06af3 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 18:31:16 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[Feat]=20#52=20-=20=EA=B2=80=EC=83=89=20tex?= =?UTF-8?q?tField=20=ED=82=A4=EB=B3=B4=EB=93=9C=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=8F=20=ED=83=AD=EB=B0=94=20hidden=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extension/UIKit+/UIViewController+.swift | 5 ++++ .../UIComponents/CustomNavigationBar.swift | 24 +++++++++++++++++++ .../VC/CourseDrawingHomeVC.swift | 1 + .../CourseDrawing/VC/DepartureSearchVC.swift | 7 ++++++ .../Views/LocationSearchResultTVC.swift | 2 +- 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIViewController+.swift b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIViewController+.swift index 9920f612..e1174385 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIViewController+.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIViewController+.swift @@ -24,4 +24,9 @@ extension UIViewController { func dismissKeyboard() { view.endEditing(true) } + + /// tabBar 숨기기 + func hideTabBar(wantsToHide: Bool) { + self.tabBarController?.tabBar.isHidden = wantsToHide + } } diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift index 182df0c6..b3fb7652 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift @@ -47,6 +47,7 @@ final class CustomNavigationBar: UIView { self.setUI(type) self.setLayout(type) self.setAddTarget() + self.setDelegate() } required init?(coder: NSCoder) { @@ -70,6 +71,10 @@ extension CustomNavigationBar { self.rightButton.addTarget(self, action: #selector(searchLocation), for: .touchUpInside) } + private func setDelegate() { + textField.delegate = self + } + @discardableResult func setTitle(_ title: String) -> Self { self.leftTitleLabel.text = title @@ -125,6 +130,12 @@ extension CustomNavigationBar { self.rightButton.isHidden = true return self } + + @discardableResult + func hideKeyboard() -> Self { + self.textField.resignFirstResponder() + return self + } } // MARK: - @objc Function @@ -136,6 +147,7 @@ extension CustomNavigationBar { @objc private func searchLocation() { guard let text = textField.text else { return } + self.hideKeyboard() delegate?.searchButtonDidTap(text: text) } @@ -152,6 +164,7 @@ extension CustomNavigationBar { extension CustomNavigationBar { private func setUI(_ type: NaviType) { + self.textField.returnKeyType = .search self.naviType = type self.backgroundColor = .m4 @@ -233,3 +246,14 @@ extension CustomNavigationBar { } } } + +// MARK: - UITextFieldDelegate + +extension CustomNavigationBar: UITextFieldDelegate { + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + guard let text = textField.text else { return true } + delegate?.searchButtonDidTap(text: text) + self.hideKeyboard() + return true + } +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift index 05a8d25e..f9452fb4 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift @@ -45,6 +45,7 @@ extension CourseDrawingHomeVC { extension CourseDrawingHomeVC { @objc private func pushToDepartureSearchVC() { let departureSearchVC = DepartureSearchVC() + departureSearchVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(departureSearchVC, animated: true) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index ff803688..1b3e6950 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -144,6 +144,10 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { courseDrawingVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(courseDrawingVC, animated: true) } + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + self.naviBar.hideKeyboard() + } } // MARK: - CustomNavigationBarDelegate @@ -158,9 +162,11 @@ extension DepartureSearchVC: CustomNavigationBarDelegate { extension DepartureSearchVC { private func searchAddressWithKeyword(keyword: String) { + LoadingIndicator.showLoading() departureSearchingProvider .request(.getAddress(keyword: keyword)) { [weak self] response in guard let self = self else { return } + LoadingIndicator.hideLoading() switch response { case .success(let result): let status = result.statusCode @@ -174,6 +180,7 @@ extension DepartureSearchVC { } if status >= 400 { print("400 error") + self.setData(data: []) } case .failure(let error): print(error.localizedDescription) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift index c8bfb08e..f81130c0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift @@ -35,7 +35,7 @@ final class LocationSearchResultTVC: UITableViewCell { } private let dividerView = UIView().then { - $0.backgroundColor = .g4 + $0.backgroundColor = .g5 } // MARK: - initialization From 988ad77d520fae377505271be338621e5ed96ce5 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 19:02:59 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[Feat]=20#52=20-=20=EC=B6=9C=EB=B0=9C?= =?UTF-8?q?=EC=A7=80=20Model=EC=9D=84=20CourseDrawingVC=EC=97=90=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=ED=95=98=EC=97=AC=20UI=20=EA=B5=AC=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 6 ++++-- .../Global/Utils/convertLocationObject.swift | 12 ++++++++++++ .../DepartureSearchingResponseDto.swift | 4 ++++ .../Network/Model/CourseDrawingModel/.gitkeep | 0 .../DepartureLocationModel.swift | 15 +++++++++++++++ .../CourseDrawing/VC/CourseDrawingVC.swift | 17 ++++++++++++++--- .../CourseDrawing/VC/DepartureSearchVC.swift | 4 ++++ 7 files changed, 53 insertions(+), 5 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/.gitkeep create mode 100644 Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/DepartureLocationModel.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 2e7533ee..d2c74ad5 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ CE0C23792966D6AF00B45063 /* ViewPager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0C23782966D6AF00B45063 /* ViewPager.swift */; }; CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */; }; CE10065529680F7000FD31FB /* DepartureSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */; }; + CE1006572968230800FD31FB /* DepartureLocationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1006562968230800FD31FB /* DepartureLocationModel.swift */; }; CE146770296568DC00DCEA1B /* RunTrackingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */; }; CE14677829658C7200DCEA1B /* Stopwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14677729658C7200DCEA1B /* Stopwatch.swift */; }; CE14677A2965A80700DCEA1B /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1467792965A80700DCEA1B /* CustomBottomSheetVC.swift */; }; @@ -154,13 +155,13 @@ CE10064429680CBC00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10064529680CC300FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10064D29680D2500FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; - CE10064E29680D2C00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10064F29680D3300FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065029680D3800FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065129680D3F00FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065229680D4400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065329680D5400FD31FB /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepartureSearchingResponseDto.swift; sourceTree = ""; }; + CE1006562968230800FD31FB /* DepartureLocationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepartureLocationModel.swift; sourceTree = ""; }; CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunTrackingVC.swift; sourceTree = ""; }; CE14677729658C7200DCEA1B /* Stopwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stopwatch.swift; sourceTree = ""; }; CE1467792965A80700DCEA1B /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; @@ -464,7 +465,7 @@ CE10064B29680D0900FD31FB /* CourseDrawingModel */ = { isa = PBXGroup; children = ( - CE10064E29680D2C00FD31FB /* .gitkeep */, + CE1006562968230800FD31FB /* DepartureLocationModel.swift */, ); path = CourseDrawingModel; sourceTree = ""; @@ -1268,6 +1269,7 @@ CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */, CEB841702963360800BF8080 /* CountDownVC.swift in Sources */, DA20D84E2966A9B300F1581F /* SearchVC.swift in Sources */, + CE1006572968230800FD31FB /* DepartureLocationModel.swift in Sources */, CE6655EC295D88D000C64E12 /* UITableView+.swift in Sources */, CEEC6B3A2961C4F300D00E1E /* CourseDrawingHomeVC.swift in Sources */, CEC2A6902962B06C00160BF7 /* convertLocationObject.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Utils/convertLocationObject.swift b/Runnect-iOS/Runnect-iOS/Global/Utils/convertLocationObject.swift index cc95fe70..0c475e9f 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Utils/convertLocationObject.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Utils/convertLocationObject.swift @@ -27,3 +27,15 @@ extension NMGLatLng { return CLLocation(latitude: lat, longitude: lng) } } + +extension DepartureLocationModel { + func toNMGLatLng() -> NMGLatLng { + guard let lat = Double(self.latitude), + let lng = Double(self.longitude) + else { + return NMGLatLng(lat: 37.52901832956373, lng: 126.9136196847032) + } + + return NMGLatLng(lat: lat, lng: lng) + } +} diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift index 32b1edb9..d2c7ce82 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift @@ -33,4 +33,8 @@ struct KakaoAddressResult: Codable { case longitude = "x" case latitude = "y" } + + func toDepartureLocationModel() -> DepartureLocationModel { + return DepartureLocationModel(departureName: self.placeName, departureAddress: self.addressName, latitude: self.latitude, longitude: self.longitude) + } } diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/DepartureLocationModel.swift b/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/DepartureLocationModel.swift new file mode 100644 index 00000000..80bc5173 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Model/CourseDrawingModel/DepartureLocationModel.swift @@ -0,0 +1,15 @@ +// +// DepartureLocationModel.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +struct DepartureLocationModel { + let departureName: String + let departureAddress: String + let latitude: String + let longitude: String +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 6c1d1ee6..432139a3 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -11,6 +11,9 @@ import Combine final class CourseDrawingVC: UIViewController { // MARK: - Properties + + private var departureLocationModel: DepartureLocationModel? + var pathImage: UIImage? private var cancelBag = CancelBag() @@ -36,7 +39,7 @@ final class CourseDrawingVC: UIViewController { $0.axis = .vertical } - private let mapView = RNMapView().makeStartMarkerAtUserLocation() + private let mapView = RNMapView() private let departureLocationLabel = UILabel().then { $0.font = .b1 @@ -107,6 +110,14 @@ final class CourseDrawingVC: UIViewController { // MARK: - Methods extension CourseDrawingVC { + func setData(model: DepartureLocationModel) { + self.departureLocationModel = model + + self.mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true) + self.departureLocationLabel.text = model.departureName + self.departureDetailLocationLabel.text = model.departureAddress + } + private func setAddTarget() { self.decideDepartureButton.addTarget(self, action: #selector(decideDepartureButtonDidTap), for: .touchUpInside) self.undoButton.addTarget(self, action: #selector(undoButtonDidTap), for: .touchUpInside) @@ -133,8 +144,8 @@ extension CourseDrawingVC { }.store(in: cancelBag) } - private func setNavigationGesture(_ enabled: Bool) { - navigationController?.interactivePopGestureRecognizer?.isEnabled = enabled + private func setNavigationGesture(_ isEnabled: Bool) { + navigationController?.interactivePopGestureRecognizer?.isEnabled = isEnabled } private func presentAlertVC() { diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 1b3e6950..8a88eec0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -141,6 +141,10 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let courseDrawingVC = CourseDrawingVC() + + let departureLocationModel = addressList[indexPath.item].toDepartureLocationModel() + courseDrawingVC.setData(model: departureLocationModel) + courseDrawingVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(courseDrawingVC, animated: true) } From 46e2ae73ac31e40e2381ab9ec15ab250536d5bf4 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Fri, 6 Jan 2023 22:59:44 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[Chore]=20#52=20-=20=EC=A7=80=EB=8F=84=20Cl?= =?UTF-8?q?ientId=20info.plist=EC=97=90=EC=84=9C=20Config=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift | 6 +++++- Runnect-iOS/Runnect-iOS/Info.plist | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift index dd546180..16053ea3 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift @@ -7,6 +7,8 @@ import UIKit +import NMapsMap + @main class AppDelegate: UIResponder, UIApplicationDelegate { @@ -16,7 +18,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + + NMFAuthManager.shared().clientId = Config.naverMapClientId + return true } diff --git a/Runnect-iOS/Runnect-iOS/Info.plist b/Runnect-iOS/Runnect-iOS/Info.plist index 5709b108..6e4730da 100644 --- a/Runnect-iOS/Runnect-iOS/Info.plist +++ b/Runnect-iOS/Runnect-iOS/Info.plist @@ -17,8 +17,6 @@ 위치 정보 권한이 필요합니다. NSLocationAlwaysAndWhenInUseUsageDescription 위치 정보 권한이 필요합니다. - NMFClientId - 1vyblfmq7l UIApplicationSceneManifest UIApplicationSupportsMultipleScenes