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 diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 17976884..24c5a15b 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -18,11 +18,13 @@ 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 */; }; + 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 */; }; @@ -36,6 +38,11 @@ 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 */; }; + 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 */; }; @@ -133,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 = ""; }; + 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 = ""; }; + 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 = ""; }; @@ -146,6 +173,11 @@ 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 = ""; }; + 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 = ""; }; @@ -158,8 +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 = ""; }; - 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 = ""; }; @@ -332,6 +362,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 = ( + CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */, + ); + 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 = ( + CE1006562968230800FD31FB /* DepartureLocationModel.swift */, + ); + path = CourseDrawingModel; + sourceTree = ""; + }; + CE10064C29680D1700FD31FB /* SignInModel */ = { + isa = PBXGroup; + children = ( + CE10064D29680D2500FD31FB /* .gitkeep */, + ); + path = SignInModel; + sourceTree = ""; + }; CE14676C296568C000DCEA1B /* Running */ = { isa = PBXGroup; children = ( @@ -514,6 +656,62 @@ path = Views; sourceTree = ""; }; + CE40BB25296807FC0030ABCA /* SignInRouter */ = { + isa = PBXGroup; + children = ( + CE10064029680C9F00FD31FB /* .gitkeep */, + ); + path = SignInRouter; + sourceTree = ""; + }; + CE40BB26296808020030ABCA /* CourseDrawingRouter */ = { + isa = PBXGroup; + children = ( + CE40BB2C296808B00030ABCA /* DepartureSearchingRouter.swift */, + ); + path = CourseDrawingRouter; + sourceTree = ""; + }; + CE40BB27296808290030ABCA /* CourseStorageRouter */ = { + isa = PBXGroup; + children = ( + CE10064129680CA700FD31FB /* .gitkeep */, + ); + path = CourseStorageRouter; + sourceTree = ""; + }; + CE40BB28296808300030ABCA /* CourseDiscoveryRouter */ = { + isa = PBXGroup; + children = ( + CE10064229680CAD00FD31FB /* .gitkeep */, + ); + path = CourseDiscoveryRouter; + sourceTree = ""; + }; + CE40BB292968083B0030ABCA /* MyPageRouter */ = { + isa = PBXGroup; + children = ( + CE10064329680CB400FD31FB /* .gitkeep */, + ); + path = MyPageRouter; + sourceTree = ""; + }; + CE40BB2A296808440030ABCA /* CourseDetailRouter */ = { + isa = PBXGroup; + children = ( + CE10064429680CBC00FD31FB /* .gitkeep */, + ); + path = CourseDetailRouter; + sourceTree = ""; + }; + CE40BB2B296808500030ABCA /* RunningRouter */ = { + isa = PBXGroup; + children = ( + CE10064529680CC300FD31FB /* .gitkeep */, + ); + path = RunningRouter; + sourceTree = ""; + }; CE4545BC295D7AF4003201E1 = { isa = PBXGroup; children = ( @@ -563,8 +761,8 @@ CE6655A9295D7FAA00C64E12 /* Network */ = { isa = PBXGroup; children = ( - CE6655B0295D800700C64E12 /* Dto */, CE6655AF295D7FF600C64E12 /* Foundation */, + CE6655B0295D800700C64E12 /* Dto */, CE6655AE295D7FF000C64E12 /* Service */, CE6655AD295D7FEA00C64E12 /* Router */, CE6655AC295D7FE400C64E12 /* Model */, @@ -597,6 +795,13 @@ CE6655AC295D7FE400C64E12 /* Model */ = { isa = PBXGroup; children = ( + CE10064C29680D1700FD31FB /* SignInModel */, + CE10064B29680D0900FD31FB /* CourseDrawingModel */, + CE10064A29680D0200FD31FB /* CourseStorageModel */, + CE10064929680CF800FD31FB /* CourseDiscoveryModel */, + CE10064829680CF200FD31FB /* MyPageModel */, + CE10064729680CED00FD31FB /* CourseDetailModel */, + CE10064629680CE600FD31FB /* RunningModel */, CE6655C1295D82F700C64E12 /* .gitkeep */, ); path = Model; @@ -605,6 +810,13 @@ CE6655AD295D7FEA00C64E12 /* Router */ = { isa = PBXGroup; children = ( + CE40BB25296807FC0030ABCA /* SignInRouter */, + CE40BB26296808020030ABCA /* CourseDrawingRouter */, + CE40BB27296808290030ABCA /* CourseStorageRouter */, + CE40BB28296808300030ABCA /* CourseDiscoveryRouter */, + CE40BB292968083B0030ABCA /* MyPageRouter */, + CE40BB2A296808440030ABCA /* CourseDetailRouter */, + CE40BB2B296808500030ABCA /* RunningRouter */, CE6655C0295D82F000C64E12 /* .gitkeep */, ); path = Router; @@ -621,8 +833,11 @@ CE6655AF295D7FF600C64E12 /* Foundation */ = { isa = PBXGroup; children = ( - CE6655BD295D82D800C64E12 /* .gitkeep */, CE5875A1296015A2005D967E /* NetworkLoggerPlugin.swift */, + CE40BB1D2968054F0030ABCA /* BaseResponse.swift */, + CE40BB1F296805F70030ABCA /* NetworkResult.swift */, + CE40BB21296806140030ABCA /* NetworkHelper.swift */, + CE40BB232968068E0030ABCA /* Config.swift */, ); path = Foundation; sourceTree = ""; @@ -630,7 +845,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 = ""; @@ -977,6 +1198,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 */, @@ -986,6 +1208,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 */, @@ -995,6 +1218,7 @@ CE665606295D91C500C64E12 /* makeVibrate.swift in Sources */, CE66560A295D924A00C64E12 /* Result+.swift in Sources */, DA20D847296697A600F1581F /* MyCourseSelectVC.swift in Sources */, + CE10065529680F7000FD31FB /* DepartureSearchingResponseDto.swift in Sources */, CE66560E295D92A500C64E12 /* setStatusBarBackgroundColor.swift in Sources */, CE9291292965E01D0010959C /* RNTimeFormatter.swift in Sources */, CE0C23792966D6AF00B45063 /* ViewPager.swift in Sources */, @@ -1007,10 +1231,12 @@ CE6655C8295D849F00C64E12 /* StringLiterals.swift in Sources */, CEEC6B3E2961C53700D00E1E /* CourseDiscoveryVC.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 */, 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 */, @@ -1036,6 +1262,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 */, @@ -1061,6 +1288,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/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/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/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/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/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/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 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/Foundation/.gitkeep b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/.gitkeep similarity index 100% rename from Runnect-iOS/Runnect-iOS/Network/Foundation/.gitkeep rename to Runnect-iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/.gitkeep 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..d2c7ce82 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/DepartureSearchingResponseDto.swift @@ -0,0 +1,40 @@ +// +// DepartureSearchingResponseDto.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +// MARK: - DepartureSearchingResponseDto + +struct DepartureSearchingResponseDto: Codable { + let documents: [KakaoAddressResult] +} + +// MARK: - KakaoAddressResult + +struct KakaoAddressResult: Codable { + let addressName, categoryGroupCode, categoryGroupName, categoryName: String + let distance, id, phone, placeName: String + let placeURL: String + let roadAddressName, latitude, longitude: 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 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/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/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..01305906 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift @@ -0,0 +1,28 @@ +// +// NetworkHelper.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/06. +// + +import Foundation + +import Moya + +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 // 네트워크 연결 실패했을 때 +} 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/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/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/CourseDrawingRouter/DepartureSearchingRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift new file mode 100644 index 00000000..ada453b0 --- /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)"] + } +} 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 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/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 9e6f1ec6..8a88eec0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -7,11 +7,23 @@ import UIKit +import Moya + final class DepartureSearchVC: UIViewController { + // MARK: - Properties + + private let departureSearchingProvider = MoyaProvider( + 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 @@ -65,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 @@ -105,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 { @@ -113,6 +131,7 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { as? LocationSearchResultTVC else { return UITableViewCell() } cell.selectionStyle = .none + cell.setData(model: self.addressList[indexPath.item]) return cell } @@ -122,16 +141,55 @@ 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) } + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + self.naviBar.hideKeyboard() + } } // MARK: - CustomNavigationBarDelegate extension DepartureSearchVC: CustomNavigationBarDelegate { func searchButtonDidTap(text: String) { - print(text) - // 서버 통신 구현 + searchAddressWithKeyword(keyword: text) + } +} + +// MARK: - Network + +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 + if 200..<300 ~= status { + do { + let responseDto = try result.map(DepartureSearchingResponseDto.self) + self.setData(data: responseDto.documents) + } catch { + print(error.localizedDescription) + } + } + if status >= 400 { + print("400 error") + self.setData(data: []) + } + case .failure(let error): + print(error.localizedDescription) + self.showToast(message: "네트워크 통신 실패") + } + } } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSearchResultTVC.swift index 7e2edb92..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 @@ -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 {