From ffd8ada60ba48f2a12ce1151f20cae06c44ff0c3 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Mon, 25 Sep 2023 20:50:01 +0900 Subject: [PATCH 01/22] =?UTF-8?q?[Add]=20#191=20-=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Literal/ImageLiterals.swift | 2 ++ .../ic_direction.imageset/Contents.json | 23 ++++++++++++++++++ .../ic_direction.imageset/ic_direction.png | Bin 0 -> 508 bytes .../ic_direction.imageset/ic_direction@2x.png | Bin 0 -> 907 bytes .../ic_direction.imageset/ic_direction@3x.png | Bin 0 -> 1241 bytes .../ic_small_map.imageset/Contents.json | 23 ++++++++++++++++++ .../ic_small_map.imageset/ic_small_map.png | Bin 0 -> 522 bytes .../ic_small_map.imageset/ic_small_map@2x.png | Bin 0 -> 909 bytes .../ic_small_map.imageset/ic_small_map@3x.png | Bin 0 -> 1289 bytes 9 files changed, 48 insertions(+) create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/Contents.json create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction.png create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction@2x.png create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction@3x.png create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_small_map.imageset/Contents.json create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_small_map.imageset/ic_small_map.png create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_small_map.imageset/ic_small_map@2x.png create mode 100644 Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_small_map.imageset/ic_small_map@3x.png diff --git a/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift b/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift index 2c61a6e8..eeb46105 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift @@ -49,6 +49,8 @@ enum ImageLiterals { static var icFollowButton: UIImage {.load(named: "ic_follow_button")} static var icFollowedButton: UIImage {.load(named: "ic_followed_button")} static var icShareButton: UIImage {.load(named: "ic_share")} + static var icSmallMap: UIImage { .load(named: "ic_small_map")} + static var icDirection: UIImage { .load(named: "ic_direction")} // img static var imgBackground: UIImage { .load(named: "img_background") } diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/Contents.json b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/Contents.json new file mode 100644 index 00000000..22e30a56 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "ic_direction.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ic_direction@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ic_direction@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction.png b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction.png new file mode 100644 index 0000000000000000000000000000000000000000..adb76a7b86205aa1c5438c4035b6a91d9eb1193f GIT binary patch literal 508 zcmVUT z!ax|rzbq*zD0~kd1ywwOoPfv)&>P?l^aR2QloOa6h$r9$I;yl(#*!{{6#Q{!U%(hQ zS3 zl5)j>kMm%agS`OuegTZ~_~FH3@oaR+7l*@PBozdwuWeUNU=({AD^9pOi^G6JrDe%?19ro-Ob$BeB20000hkdTZ7 z5(^%w-?Whd!*t^w$R`=U$DgX&?d}?bE~L}x@-~IZK@Jf_r$v z47-}&y2cgdKnei~J8>k4wBiQ3G6;xx_8xmF<_o^^g+J+raGNZ1o2>2j{S9t+Nu-uH zlXP2LZjT@R_P9$i`Z>D29I%CphZjK+y+8CH!BPBxC|cMNUkQ2-Y}=;i=Vyw=VzgW? zsoU*J-Nyk#|6B0{b$2O2DgJivjzds^A_NVLN;sSiipVLcAfwTU27>{~g3jCGpFCZN zj8u^EcuXpA(@R<0@4TqAKUFE8#bQCO>yip+dKUjAWiF1#u{H&~}2OJX%Jdh6iJTG=$UXbZ9fUFulMvgr@a7^xI`lN~3Y<6@k zN_v^Uh+vB}5hfTRy`XRM^iNv^=kxjAe#G?RQ`a25npdQpYI+7skZ)<_e6JB*rMR35PQ1jYDYOB5jmxv(xr7L-Q(vPf{!WQ$?H?h=P8 zj+n$d*x5~*5Jf&wr5gi>U{Psr;?5_~7PY-Fs<7NEJJf^6LTfWTfxmX?1N3vb+^55X zp|u%)gFfR1x)SJ8(C$Ldox8EsY9ZxCdPhWBPnP)1b2oFyOZ*4E@uoxi!An^_CkJFp zz^FV_c=HQs08!&rC9EEJh-wkt7tN7+9mf@7H5oAnSY-gk=}9M!0-S7002ovPDHLkV1l-qoCyE` literal 0 HcmV?d00001 diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction@3x.png b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_direction.imageset/ic_direction@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..f36dbb77ea8d2d3cd5253d6c048a85d23135eae6 GIT binary patch literal 1241 zcmV;~1Sb25P)!;0C}6l7K`(v!SFwYYGYqw21@~ z1%LKE?>KT2+ez%1Ny1Mu{*xi`^St>yY#9+y~x-`>JG)GjVAwq!(xu3;5*Y2O{0AW+*?SbTTr^1~FOSYAE-EzNL`XnZVFjOw6N`;PY>n8J1&M@zM5FMP1i(!AHo^ou3zH}tu*tA=6a4Osb9 zz7XnGRS)*NY8YY<<%^*l+o2sa)A6WW_SYlX_VIChJB`fHNl>D_C`u!Dyq!AhB`ubX4Utc9Fv^CBpU&My! zCacH*+F6HKML7?#WzmE#kzsV$IRLTB&BNQPSpt>`kzt;mo(Bb2)DPl z1IwDSGw>+b$i#CTFE1|x%b2n=C*CReMl8ab9#ng#?2KD*+kxt)Sf<@>$9`te&ZKFr z4TqtqI851@VBAo5FtJ=0%OnXlWoJdx;bRY#Kw^!!z-7|T)JU!VQ%f}FhFBynaGA6- zIOiWn=;Wur5+AUA67w(q9@tj&8QTmC`L*UZ!{VVX4^7B zr~ox|O7lnw;-yk)2S333v?t?-&24uSu_W~?0GLGI$L3EN1MKs&gOuhKfJ`rWK==lP zGq=kX3n-xn;laSj-ys@c9+Y}LpezQ^A++;dq7hmhs||?%q2om@h~%TEs?N96vigP)#Znc=} zlLQ*&Ct0?i<1e4>XB(8jY&Nq>rP6?#&gpb&b8SaMo?#e1*WaB^XOcA6&;#@Nyw4(^ z+_WegpT$SIu+YTbS?uc$F<|4zi^bwC(IEzo$K#N4z)nBd>1!;=&IZvkbHiqyy4~(n z3c9ZQLw_3|Q!bauvMdV2kaoLW97ha&HO7Q2+At$`7h<(qjq3HfoCq*+zu(h(y{1Z~ zBI7|2$f6)K!{kO!cUG-dV==H?E@i*fYEc$!>{00M(!jFs-~nmVrsA*#6$}J@Dh^L@ zQhK+(QV-|`0Z!TF(oY)2L2S2MYBrl>n&w4(v)NpI&v`gC@UjRYkl3*eBs7Y8vS~@K z;5&}f5PV&b;m_&_Cg^E`*lM*(6N9@EYI(}IgItX%ClF(eNh}E1?#uZv{}dau*znxH zdSH1^2fU|v<7~=CZdJ58N)=Rv`Lg$-t9ianc%{9=;egDTVE^@bzjvg`W|b`dFaQ7m M07*qoM6N<$f`>)sTL1t6 literal 0 HcmV?d00001 diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_small_map.imageset/ic_small_map@2x.png b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_small_map.imageset/ic_small_map@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4433c070683b022e387dfbfbea642379fe8701d7 GIT binary patch literal 909 zcmV;819JR{P)`HS&Bi|f_x-+S(fCMVMAbaLzUI*Hq?eKqVtEEH4IG!t!qbX{+z z)9I$1fEJ{4qtP&8u~=cXS`}Sl{6fLa<#Jic=kuoDLB0f1*wxk58>~^35P;CSU!g|@ z!j-gGS%O>a7_?|5lgZQ%bvh`p-ERL3%W8WCXj&B_OMBbBDs7kkhPa%Zhc3JXkLRu3 z2HmSSzPiR4#gQZp;??j@Al=FVa%N}{``ue?xfmV3qvJ2RAefUS%*pEJw{wGe7pH4+ z8<)#sVLpC#=Htf2T<7HS;)r2uQ78-A*83aaA##0vEsu|na(jC#*j;2a8p(7zmHB+` z{Z_+}hldBj0xg5V;OO&V#ZRd47IYqWD5LH#ax(^70~pwFQ-FXPC{fdnMkkKlQ6*4OX^s6UL~S%>go6sm+11!bucc`#h}2j|{oVsOM)n>CSx-Vk8)@YomSsPElwZ5WNpq-!*Y{ zOF{yxZlh!Q^IBpFe)|iqp>lF^@U2EW@bj^reMmck_p;lTeK|9nGfzpMPh*Brl+T6 zVq!vy#bWFD!^4AIU0uoj{k=RsJ`Svh-<_MAYt>P&*VT8!;g*F>U;WSguM+L!^m$SLK z`QH7|HhJ*gi7-%T6qlpO>+9=80($75+IIMKtq+@8Ig4-u8`|zy@3F4wA*{?3-ok{! z@$=X&!CWzi8yLBEmY@c|Elj=v0G!C@@-N9L5c>-n_Wk~6_4(2dWO=WXacTip}v;zZ3e#v~ngo(AL9&K|I}wQFNBwyXLn=$&XMQ#E*}U*_mxihR_{U z;4RIe!n7EoeZvp%Iqk^n!{)XVMl3OY1ppI`A1Hp7SAer04v Date: Mon, 25 Sep 2023 22:39:22 +0900 Subject: [PATCH 02/22] =?UTF-8?q?[Feat]=20#191=20-=20=20=ED=98=84=EC=9E=AC?= =?UTF-8?q?=20=EC=9C=84=EC=B9=98=20=ED=98=B9=EC=9D=80=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=20=EC=84=A0=ED=83=9D=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDrawing/VC/DepartureSearchVC.swift | 41 ++++++++- .../Views/LocationSelectView.swift | 88 +++++++++++++++++++ 2 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSelectView.swift diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index d135000a..83619fb5 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -27,6 +27,21 @@ final class DepartureSearchVC: UIViewController { $0.backgroundColor = .g5 } + private let selectDirectionView = LocationSelectView(type: .current) + private let selectMapView = LocationSelectView(type: .map) + + private lazy var locationSelectStackView = UIStackView().then { + $0.addArrangedSubview(selectDirectionView) + $0.addArrangedSubview(selectMapView) + $0.axis = .horizontal + $0.distribution = .fillEqually + $0.alignment = .center + } + + private let thinDividerView = UIView().then { + $0.backgroundColor = .g5 + } + private let locationTableView = UITableView(frame: .zero, style: .plain).then { $0.backgroundColor = .white $0.separatorStyle = .none @@ -92,7 +107,7 @@ extension DepartureSearchVC { } private func setLayout() { - view.addSubviews(naviBar, dividerView, locationTableView) + view.addSubviews(naviBar, dividerView, locationSelectStackView, thinDividerView, locationTableView) naviBar.snp.makeConstraints { make in make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide) @@ -105,8 +120,30 @@ extension DepartureSearchVC { make.height.equalTo(6) } - locationTableView.snp.makeConstraints { make in + locationSelectStackView.snp.makeConstraints { make in make.top.equalTo(dividerView.snp.bottom) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(8) + make.height.equalTo(52) + } + + selectDirectionView.snp.makeConstraints { make in + make.height.equalTo(locationSelectStackView.snp.height) + make.centerY.equalTo(locationSelectStackView) + } + + selectMapView.snp.makeConstraints { make in + make.height.equalTo(locationSelectStackView.snp.height) + make.centerY.equalTo(locationSelectStackView) + } + + thinDividerView.snp.makeConstraints { make in + make.top.equalTo(locationSelectStackView.snp.bottom) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(1) + } + + locationTableView.snp.makeConstraints { make in + make.top.equalTo(thinDividerView.snp.bottom) make.leading.bottom.trailing.equalTo(view.safeAreaLayoutGuide) } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSelectView.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSelectView.swift new file mode 100644 index 00000000..3a44a77f --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/Views/LocationSelectView.swift @@ -0,0 +1,88 @@ +// +// LocationSelectView.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/09/25. +// + +import UIKit +import Then +import SnapKit + +enum locationType { + case current + case map + + var icon: UIImage { + switch self { + case .current: + return ImageLiterals.icDirection + case .map: + return ImageLiterals.icSmallMap + } + } + + var text: String { + switch self { + case .current: + return "현재 위치에서 시작하기" + case .map: + return "지도에서 선택하기" + } + } + + var width: Int { + switch self { + case .current: + return 167 + case .map: + return 138 + } + } +} + +class LocationSelectView: BaseView { + let type: locationType + + private lazy var view = UIView() + private lazy var icon = UIImageView().then { + $0.image = type.icon + } + + private lazy var label = UILabel().then { + $0.text = type.text + $0.font = .h5 + $0.textColor = .g3 + $0.sizeToFit() + } + + init(type: locationType) { + self.type = type + + super.init(frame: .zero) + } + + override func setLayout() { + super.setLayout() + + view.addSubviews(icon, label) + addSubviews(view) + + icon.snp.makeConstraints { + $0.width.height.equalTo(20) + $0.leading.equalToSuperview() + $0.centerY.equalToSuperview() + } + + label.snp.makeConstraints { + $0.leading.equalTo(icon.snp.trailing).offset(5) + $0.centerY.equalToSuperview() + } + + view.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.leading.equalToSuperview().offset(20) + $0.width.equalTo(type.width) + } + } +} From 58b23f5c19036d820e91d58f87516ada0d899253 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Mon, 25 Sep 2023 22:39:40 +0900 Subject: [PATCH 03/22] =?UTF-8?q?[Feat]=20#191=20-=20BaseView=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 18 +++++++- .../Runnect-iOS/Global/Base/BaseView.swift | 41 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Runnect-iOS/Runnect-iOS/Global/Base/BaseView.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 47b9d4dc..2bd1ae81 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -8,6 +8,8 @@ /* Begin PBXBuildFile section */ 0AEBD608F3973389E8E1C6D6 /* Pods_Runnect_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */; }; + 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; + 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 71DBF23E2ABB255A0013415B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */; }; A3305A97296EF58C000B1A10 /* GoalRewardInfoDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */; }; @@ -163,10 +165,12 @@ /* Begin PBXFileReference section */ 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runnect_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; + 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 3C3033C911343B5C57EB68E7 /* Pods-Runnect-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runnect-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Runnect-iOS/Pods-Runnect-iOS.debug.xcconfig"; sourceTree = ""; }; 7110A6032AA337DD009A7E99 /* Runnect-iOSDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Runnect-iOSDebug.entitlements"; sourceTree = ""; }; 712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; - 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Runnect-iOS/Runnect-iOS/Runnect-iOS/GoogleService-Info.plist"; sourceTree = ""; }; + 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runnect-iOS/GoogleService-Info.plist"; sourceTree = SOURCE_ROOT; }; A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoDto.swift; sourceTree = ""; }; A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoVC.swift; sourceTree = ""; }; A3BC2F2C2962C3F200198261 /* ActivityRecordInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoVC.swift; sourceTree = ""; }; @@ -343,6 +347,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 23EE06C32AC1AE0600CB3FF8 /* Base */ = { + isa = PBXGroup; + children = ( + 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */, + ); + path = Base; + sourceTree = ""; + }; 3F7098551CF7A77F3FE7EB2B /* Pods */ = { isa = PBXGroup; children = ( @@ -669,6 +681,7 @@ isa = PBXGroup; children = ( CEB8416D2962C45300BF8080 /* LocationSearchResultTVC.swift */, + 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */, ); path = Views; sourceTree = ""; @@ -884,6 +897,7 @@ CE6655AA295D7FAE00C64E12 /* Global */ = { isa = PBXGroup; children = ( + 23EE06C32AC1AE0600CB3FF8 /* Base */, CE6655B6295D803C00C64E12 /* UIComponents */, CE6655B5295D803800C64E12 /* Literal */, CE6655B4295D803400C64E12 /* Resource */, @@ -1343,6 +1357,7 @@ CE6655F4295D898400C64E12 /* UIViewController+.swift in Sources */, CE14677829658C7200DCEA1B /* Stopwatch.swift in Sources */, CE21C026299E5FF300F62AF5 /* CourseRouter.swift in Sources */, + 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */, CE40BB22296806140030ABCA /* NetworkHelper.swift in Sources */, CE5645162961B72E000A2856 /* ImageLiterals.swift in Sources */, CE4942AD296FCD2300736701 /* UploadedCourseDetailResponseDto.swift in Sources */, @@ -1397,6 +1412,7 @@ CE6655FE295D912300C64E12 /* calculateTopInset.swift in Sources */, CEEC6B492961C5E200D00E1E /* SplashVC.swift in Sources */, CE6655D0295D85FF00C64E12 /* CancelBag.swift in Sources */, + 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */, CE102C4A29DBAD3D00E23E69 /* AuthInterceptor.swift in Sources */, A3BC2F432966A93100198261 /* CourseDetailVC.swift in Sources */, DAD5A3D8296C6D9600C8166B /* AdImageCollectionViewCell.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Base/BaseView.swift b/Runnect-iOS/Runnect-iOS/Global/Base/BaseView.swift new file mode 100644 index 00000000..e151b1d5 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Global/Base/BaseView.swift @@ -0,0 +1,41 @@ +// +// BaseView.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/09/25. +// + +import UIKit +import SnapKit + +protocol BaseViewProtocol { + func setDelegate() + func setUI() + func setLayout() +} + +class BaseView: UIView, BaseViewProtocol { + // MARK: - Initializer + + override init(frame: CGRect) { + super.init(frame: frame) + + setDelegate() + setUI() + setLayout() + } + + @available(*, unavailable) + required init?(coder _: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Setup Methods + + func setDelegate() { } + + func setUI() { } + + func setLayout() { } +} + From 442c834807faf0a5097ac6c6ec753a913e14610e Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 26 Sep 2023 00:33:02 +0900 Subject: [PATCH 04/22] =?UTF-8?q?[Feat]=20#191=20-=20combineCocoa=20?= =?UTF-8?q?=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Podfile | 1 + Runnect-iOS/Podfile.lock | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Podfile b/Runnect-iOS/Podfile index c9ac53f9..e541b7b7 100644 --- a/Runnect-iOS/Podfile +++ b/Runnect-iOS/Podfile @@ -16,6 +16,7 @@ target 'Runnect-iOS' do pod 'KakaoSDKShare' pod 'KakaoSDKTemplate' pod 'FirebaseDynamicLinks' + pod 'CombineCocoa' # Pods for Runnect-iOS diff --git a/Runnect-iOS/Podfile.lock b/Runnect-iOS/Podfile.lock index 5b4d89c1..5421d835 100644 --- a/Runnect-iOS/Podfile.lock +++ b/Runnect-iOS/Podfile.lock @@ -1,5 +1,6 @@ PODS: - Alamofire (5.7.1) + - CombineCocoa (0.4.1) - FirebaseCore (10.14.0): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.8) @@ -42,6 +43,7 @@ PODS: - Then (3.0.0) DEPENDENCIES: + - CombineCocoa - FirebaseDynamicLinks - KakaoSDKAuth - KakaoSDKCommon @@ -57,6 +59,7 @@ DEPENDENCIES: SPEC REPOS: trunk: - Alamofire + - CombineCocoa - FirebaseCore - FirebaseCoreInternal - FirebaseDynamicLinks @@ -76,6 +79,7 @@ SPEC REPOS: SPEC CHECKSUMS: Alamofire: 0123a34370cb170936ae79a8df46cc62b2edeb88 + CombineCocoa: e5210dbfb480ff251078929459ac17e750e7af1d FirebaseCore: 6fc17ac9f03509d51c131298aacb3ee5698b4f02 FirebaseCoreInternal: d558159ee6cc4b823c2296ecc193de9f6d9a5bb3 FirebaseDynamicLinks: 0eaabff2d0e5d0e576c0227227b00771aa2f3aaf @@ -93,6 +97,6 @@ SPEC CHECKSUMS: SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25 Then: 844265ae87834bbe1147d91d5d41a404da2ec27d -PODFILE CHECKSUM: 43e89e9e217761b44c0c7e93fb4abfab29a82ece +PODFILE CHECKSUM: 9cec08e47233bfd653e7a2b2c95bde1b7426add8 COCOAPODS: 1.12.1 From bb600b2be9eab6da9b1afd639e97d4870de56f86 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 26 Sep 2023 00:33:41 +0900 Subject: [PATCH 05/22] =?UTF-8?q?[Feat]=20#191=20-=20view=EC=97=90=20tapge?= =?UTF-8?q?sture=20=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 | 4 + .../UIKit+/UIGestureRecognizer+.swift | 82 +++++++++++++++++++ .../Global/Extension/UIKit+/UIView+.swift | 6 ++ .../Global/Utils/GesturePublisher.swift | 80 ++++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIGestureRecognizer+.swift create mode 100644 Runnect-iOS/Runnect-iOS/Global/Utils/GesturePublisher.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 2bd1ae81..b8826b00 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 0AEBD608F3973389E8E1C6D6 /* Pods_Runnect_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */; }; 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; + 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 71DBF23E2ABB255A0013415B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */; }; A3305A97296EF58C000B1A10 /* GoalRewardInfoDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */; }; @@ -167,6 +168,7 @@ 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runnect_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; + 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; 3C3033C911343B5C57EB68E7 /* Pods-Runnect-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runnect-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Runnect-iOS/Pods-Runnect-iOS.debug.xcconfig"; sourceTree = ""; }; 7110A6032AA337DD009A7E99 /* Runnect-iOSDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Runnect-iOSDebug.entitlements"; sourceTree = ""; }; 712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; @@ -1005,6 +1007,7 @@ CE58759F29601500005D967E /* Toast.swift */, CE6655C9295D84DD00C64E12 /* UserDefaultKeyList.swift */, CE29D583296416D800F47542 /* caculateStatusBarHeight.swift */, + 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */, ); path = Utils; sourceTree = ""; @@ -1422,6 +1425,7 @@ CE21C02C299E601000F62AF5 /* ScrapRouter.swift in Sources */, A3D1A78029CF142E00DD54EC /* UserManager.swift in Sources */, A3D1A77929CF03D200DD54EC /* AuthRouter.swift in Sources */, + 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */, A3C38FED2A13212300FF196D /* SetInfoLayout.swift in Sources */, CE6655D4295D865B00C64E12 /* Publisher+UIControl.swift in Sources */, CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIGestureRecognizer+.swift b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIGestureRecognizer+.swift new file mode 100644 index 00000000..bc91c87b --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIGestureRecognizer+.swift @@ -0,0 +1,82 @@ +// +// UIGestureRecognizer+.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/09/26. +// + +import UIKit +import Combine + +enum GestureType { + case tap(UITapGestureRecognizer = .init()) + case swipe(UISwipeGestureRecognizer = .init()) + case longPress(UILongPressGestureRecognizer = .init()) + case pan(UIPanGestureRecognizer = .init()) + case pinch(UIPinchGestureRecognizer = .init()) + case edge(UIScreenEdgePanGestureRecognizer = .init()) + func get() -> UIGestureRecognizer { + switch self { + case let .tap(tapGesture): + return tapGesture + case let .swipe(swipeGesture): + return swipeGesture + case let .longPress(longPressGesture): + return longPressGesture + case let .pan(panGesture): + return panGesture + case let .pinch(pinchGesture): + return pinchGesture + case let .edge(edgePanGesture): + return edgePanGesture + } + } +} + +extension UIGestureRecognizer { + struct GesturePublisher: Publisher { + typealias Output = GestureType + typealias Failure = Never + private let view: UIView + private let gestureType: GestureType + init(view: UIView, gestureType: GestureType) { + self.view = view + self.gestureType = gestureType + } + func receive(subscriber: S) where S : Subscriber, + GesturePublisher.Failure == S.Failure, GesturePublisher.Output + == S.Input { + let subscription = GestureSubscription( + subscriber: subscriber, + view: view, + gestureType: gestureType + ) + subscriber.receive(subscription: subscription) + } + } + + class GestureSubscription: Subscription where S.Input == GestureType, S.Failure == Never { + private var subscriber: S? + private var gestureType: GestureType + private var view: UIView + init(subscriber: S, view: UIView, gestureType: GestureType) { + self.subscriber = subscriber + self.view = view + self.gestureType = gestureType + configureGesture(gestureType) + } + private func configureGesture(_ gestureType: GestureType) { + let gesture = gestureType.get() + gesture.addTarget(self, action: #selector(handler)) + view.addGestureRecognizer(gesture) + } + func request(_ demand: Subscribers.Demand) { } + func cancel() { + subscriber = nil + } + @objc + private func handler() { + _ = subscriber?.receive(gestureType) + } + } +} diff --git a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIView+.swift b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIView+.swift index 5b0f12ee..c8bbabb5 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIView+.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIView+.swift @@ -36,6 +36,12 @@ extension UIView { layer.cornerRadius = cornerRadius layer.maskedCorners = CACornerMask(arrayLiteral: maskedCorners) } + + /// view에 tap gesture를 연결해주는 함수 + func gesture(_ gestureType: GestureType = .tap()) -> + GesturePublisher { + .init(view: self, gestureType: gestureType) + } } class XibView: UIView { diff --git a/Runnect-iOS/Runnect-iOS/Global/Utils/GesturePublisher.swift b/Runnect-iOS/Runnect-iOS/Global/Utils/GesturePublisher.swift new file mode 100644 index 00000000..5c7d7fbc --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Global/Utils/GesturePublisher.swift @@ -0,0 +1,80 @@ +// +// GesturePublisher.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/09/26. +// + +import UIKit +import Combine + +enum GestureType { + case tap(UITapGestureRecognizer = .init()) + case swipe(UISwipeGestureRecognizer = .init()) + case longPress(UILongPressGestureRecognizer = .init()) + case pan(UIPanGestureRecognizer = .init()) + case pinch(UIPinchGestureRecognizer = .init()) + case edge(UIScreenEdgePanGestureRecognizer = .init()) + func get() -> UIGestureRecognizer { + switch self { + case let .tap(tapGesture): + return tapGesture + case let .swipe(swipeGesture): + return swipeGesture + case let .longPress(longPressGesture): + return longPressGesture + case let .pan(panGesture): + return panGesture + case let .pinch(pinchGesture): + return pinchGesture + case let .edge(edgePanGesture): + return edgePanGesture + } + } +} + +struct GesturePublisher: Publisher { + typealias Output = GestureType + typealias Failure = Never + private let view: UIView + private let gestureType: GestureType + init(view: UIView, gestureType: GestureType) { + self.view = view + self.gestureType = gestureType + } + func receive(subscriber: S) where S : Subscriber, + GesturePublisher.Failure == S.Failure, GesturePublisher.Output + == S.Input { + let subscription = GestureSubscription( + subscriber: subscriber, + view: view, + gestureType: gestureType + ) + subscriber.receive(subscription: subscription) + } +} + +class GestureSubscription: Subscription where S.Input == GestureType, S.Failure == Never { + private var subscriber: S? + private var gestureType: GestureType + private var view: UIView + init(subscriber: S, view: UIView, gestureType: GestureType) { + self.subscriber = subscriber + self.view = view + self.gestureType = gestureType + configureGesture(gestureType) + } + private func configureGesture(_ gestureType: GestureType) { + let gesture = gestureType.get() + gesture.addTarget(self, action: #selector(handler)) + view.addGestureRecognizer(gesture) + } + func request(_ demand: Subscribers.Demand) { } + func cancel() { + subscriber = nil + } + @objc + private func handler() { + _ = subscriber?.receive(gestureType) + } +} From 1a8cb86f5221533c633e3ba8905ff7fd7003c965 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 26 Sep 2023 16:17:04 +0900 Subject: [PATCH 06/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=9C=84=EB=8F=84=20?= =?UTF-8?q?=EA=B2=BD=EB=8F=84=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8A=94=20api=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 | 4 + ...DepartureAddressSearchingResponseDto.swift | 75 +++++++++++++++++++ .../DepartureSearchingRouter.swift | 19 ++++- .../CourseDrawing/VC/DepartureSearchVC.swift | 69 ++++++++++++++++- 4 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index b8826b00..8bd410b5 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; + 23EE06CB2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06CA2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 71DBF23E2ABB255A0013415B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */; }; A3305A97296EF58C000B1A10 /* GoalRewardInfoDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */; }; @@ -169,6 +170,7 @@ 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; + 23EE06CA2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepartureAddressSearchingResponseDto.swift; sourceTree = ""; }; 3C3033C911343B5C57EB68E7 /* Pods-Runnect-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runnect-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Runnect-iOS/Pods-Runnect-iOS.debug.xcconfig"; sourceTree = ""; }; 7110A6032AA337DD009A7E99 /* Runnect-iOSDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Runnect-iOSDebug.entitlements"; sourceTree = ""; }; 712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; @@ -776,6 +778,7 @@ children = ( CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */, CE320F37296C8FAB009F89A7 /* CourseDrawingResponseData.swift */, + 23EE06CA2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift */, ); path = ResponseDto; sourceTree = ""; @@ -1484,6 +1487,7 @@ CE102C4829DB1D6B00E23E69 /* GetNewTokenResponseDto.swift in Sources */, CE6655CA295D84DD00C64E12 /* UserDefaultKeyList.swift in Sources */, 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */, + 23EE06CB2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift in Sources */, CE6655F2295D894D00C64E12 /* UIView+.swift in Sources */, CE9291252965C9FB0010959C /* CourseDetailInfoView.swift in Sources */, CE665600295D915D00C64E12 /* getClassName.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift new file mode 100644 index 00000000..c81444ae --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift @@ -0,0 +1,75 @@ +// +// DepartureAddressSearchingResponseDto.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/09/26. +// + +import Foundation + +// MARK: - DepartureAddressSearchingResponseDto +struct DepartureAddressSearchingResponseDto: Codable { + let meta: Meta + let documents: [Document] + + func toDepartureLocationModel(latitude: Double, longitude: Double) -> DepartureLocationModel { + let roadName = self.documents[0].roadAddress.buildingName ?? "내가 설정한 출발지" + + return DepartureLocationModel(departureName: roadName, departureAddress: self.documents[0].address.addressName, latitude: String(latitude), longitude: String(longitude)) + } +} + +// MARK: - Document +struct Document: Codable { + let roadAddress: RoadAddress + let address: Address + + enum CodingKeys: String, CodingKey { + case roadAddress = "road_address" + case address + } +} + +// MARK: - Address +struct Address: Codable { + let addressName, region1DepthName, region2DepthName, region3DepthName: String + let mountainYn, mainAddressNo: String + + enum CodingKeys: String, CodingKey { + case addressName = "address_name" + case region1DepthName = "region_1depth_name" + case region2DepthName = "region_2depth_name" + case region3DepthName = "region_3depth_name" + case mountainYn = "mountain_yn" + case mainAddressNo = "main_address_no" + } +} + +// MARK: - RoadAddress +struct RoadAddress: Codable { + let addressName, region1DepthName, region2DepthName, region3DepthName: String + let roadName, undergroundYn, mainBuildingNo, subBuildingNo: String + let buildingName, zoneNo: String + + enum CodingKeys: String, CodingKey { + case addressName = "address_name" + case region1DepthName = "region_1depth_name" + case region2DepthName = "region_2depth_name" + case region3DepthName = "region_3depth_name" + case roadName = "road_name" + case undergroundYn = "underground_yn" + case mainBuildingNo = "main_building_no" + case subBuildingNo = "sub_building_no" + case buildingName = "building_name" + case zoneNo = "zone_no" + } +} + +// MARK: - Meta +struct Meta: Codable { + let totalCount: Int + + enum CodingKeys: String, CodingKey { + case totalCount = "total_count" + } +} diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift index ada453b0..1b406290 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift @@ -11,14 +11,23 @@ import Moya enum DepartureSearchingRouter { case getAddress(keyword: String) + case getLocationAddress(latitude: Double, longitude: Double) } extension DepartureSearchingRouter: TargetType { var baseURL: URL { - guard let url = URL(string: Config.kakaoAddressBaseURL) else { - fatalError("baseURL could not be configured") + var urlString: String + + switch self { + case .getAddress(let keyword): + urlString = Config.kakaoAddressBaseURL + case .getLocationAddress: + urlString = "https://dapi.kakao.com/v2/local/geo" } + guard let url = URL(string: urlString) else { + fatalError("baseURL could not be configured") + } return url } @@ -26,12 +35,14 @@ extension DepartureSearchingRouter: TargetType { switch self { case .getAddress: return "/keyword.json" + case .getLocationAddress: + return "/coord2address.json" } } var method: Moya.Method { switch self { - case .getAddress: + case .getAddress, .getLocationAddress: return .get } } @@ -40,6 +51,8 @@ extension DepartureSearchingRouter: TargetType { switch self { case .getAddress(let keyword): return .requestParameters(parameters: ["query": keyword], encoding: URLEncoding.default) + case .getLocationAddress(let latitude, let longitude): + return .requestParameters(parameters: ["x": longitude, "y": latitude], encoding: URLEncoding.default) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 83619fb5..5f219a21 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -7,15 +7,19 @@ import UIKit +import Combine import Moya +import CoreLocation -final class DepartureSearchVC: UIViewController { +final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { // MARK: - Properties private let departureSearchingProvider = Providers.departureSearchingProvider private var addressList = [KakaoAddressResult]() + private var cancelBag = CancelBag() + var locationManager = CLLocationManager() // MARK: - UI Components @@ -74,6 +78,7 @@ final class DepartureSearchVC: UIViewController { self.setLayout() self.setDelegate() self.registerCell() + self.setBinding() } } @@ -96,6 +101,38 @@ extension DepartureSearchVC { emptyDataView.isHidden = !data.isEmpty locationTableView.reloadData() } + + private func setBinding() { + selectDirectionView.gesture().sink { _ in + self.setLocation() + }.store(in: cancelBag) + + selectMapView.gesture().sink { _ in + + }.store(in: cancelBag) + } + +} + +// MARK: - Location +extension DepartureSearchVC { + private func setLocation() { + locationManager.delegate = self + locationManager.desiredAccuracy = kCLLocationAccuracyBest + + DispatchQueue.global().async { [self] in + if CLLocationManager.locationServicesEnabled() { + self.locationManager.startUpdatingLocation() + + guard let latitude = locationManager.location?.coordinate.latitude, + let longitude = locationManager.location?.coordinate.longitude else { return } + searchLocationAddress(latitude: latitude, longitude: longitude) + } + else { + locationManager.startUpdatingLocation() + } + } + } } // MARK: - UI & Layout @@ -227,4 +264,34 @@ extension DepartureSearchVC { } } } + + private func searchLocationAddress(latitude: Double, longitude: Double) { + departureSearchingProvider + .request(.getLocationAddress(latitude: latitude, longitude: longitude)) { [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(DepartureAddressSearchingResponseDto.self) + let courseDrawingVC = CourseDrawingVC() + + courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) + + courseDrawingVC.hidesBottomBarWhenPushed = true + self.navigationController?.pushViewController(courseDrawingVC, animated: true) + } catch { + print(error.localizedDescription) + } + } + if status >= 400 { + print("400 error") + } + case .failure(let error): + print(error.localizedDescription) + self.showToast(message: "네트워크 통신 실패") + } + } + } } From f261df1e4f6cdeb0930fca1895b3fdff35ad4610 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Tue, 26 Sep 2023 21:09:46 +0900 Subject: [PATCH 07/22] =?UTF-8?q?[Feat]=20#191=20-=20tmap=20api=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 | 12 ++++--- ...> KakakoAddressSearchingResponseDto.swift} | 2 +- .../TmapAddressSearchingResponseDto.swift | 35 +++++++++++++++++++ .../DepartureSearchingRouter.swift | 13 +++++-- .../CourseDrawing/VC/DepartureSearchVC.swift | 35 +++++++++++++++++-- 5 files changed, 87 insertions(+), 10 deletions(-) rename Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/{DepartureAddressSearchingResponseDto.swift => KakakoAddressSearchingResponseDto.swift} (97%) create mode 100644 Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/TmapAddressSearchingResponseDto.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 8bd410b5..8662ebec 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -11,7 +11,8 @@ 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; - 23EE06CB2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06CA2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift */; }; + 23EE06CB2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06CA2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift */; }; + 23EE06D12AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 71DBF23E2ABB255A0013415B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */; }; A3305A97296EF58C000B1A10 /* GoalRewardInfoDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */; }; @@ -170,7 +171,8 @@ 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; - 23EE06CA2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepartureAddressSearchingResponseDto.swift; sourceTree = ""; }; + 23EE06CA2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakakoAddressSearchingResponseDto.swift; sourceTree = ""; }; + 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TmapAddressSearchingResponseDto.swift; sourceTree = ""; }; 3C3033C911343B5C57EB68E7 /* Pods-Runnect-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runnect-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Runnect-iOS/Pods-Runnect-iOS.debug.xcconfig"; sourceTree = ""; }; 7110A6032AA337DD009A7E99 /* Runnect-iOSDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Runnect-iOSDebug.entitlements"; sourceTree = ""; }; 712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; @@ -778,7 +780,8 @@ children = ( CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */, CE320F37296C8FAB009F89A7 /* CourseDrawingResponseData.swift */, - 23EE06CA2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift */, + 23EE06CA2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift */, + 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */, ); path = ResponseDto; sourceTree = ""; @@ -1426,6 +1429,7 @@ CE6655DC295D873500C64E12 /* UIButton+.swift in Sources */, CEFA9A2F29FC263700F2D0CF /* UserDeleteResponseDto.swift in Sources */, CE21C02C299E601000F62AF5 /* ScrapRouter.swift in Sources */, + 23EE06D12AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift in Sources */, A3D1A78029CF142E00DD54EC /* UserManager.swift in Sources */, A3D1A77929CF03D200DD54EC /* AuthRouter.swift in Sources */, 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */, @@ -1487,7 +1491,7 @@ CE102C4829DB1D6B00E23E69 /* GetNewTokenResponseDto.swift in Sources */, CE6655CA295D84DD00C64E12 /* UserDefaultKeyList.swift in Sources */, 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */, - 23EE06CB2AC2AF3E00CB3FF8 /* DepartureAddressSearchingResponseDto.swift in Sources */, + 23EE06CB2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift in Sources */, CE6655F2295D894D00C64E12 /* UIView+.swift in Sources */, CE9291252965C9FB0010959C /* CourseDetailInfoView.swift in Sources */, CE665600295D915D00C64E12 /* getClassName.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakakoAddressSearchingResponseDto.swift similarity index 97% rename from Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift rename to Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakakoAddressSearchingResponseDto.swift index c81444ae..aa67dec3 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/DepartureAddressSearchingResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakakoAddressSearchingResponseDto.swift @@ -8,7 +8,7 @@ import Foundation // MARK: - DepartureAddressSearchingResponseDto -struct DepartureAddressSearchingResponseDto: Codable { +struct KakakoAddressSearchingResponseDto: Codable { let meta: Meta let documents: [Document] diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/TmapAddressSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/TmapAddressSearchingResponseDto.swift new file mode 100644 index 00000000..185464fb --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/TmapAddressSearchingResponseDto.swift @@ -0,0 +1,35 @@ +// +// TmapAddressSearchingResponseDto.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/09/26. +// + +import Foundation + +// MARK: - TmapAddressSearchingResponseDto +struct TmapAddressSearchingResponseDto: Codable { + let addressInfo: AddressInfo + + func toDepartureLocationModel(latitude: Double, longitude: Double) -> DepartureLocationModel { + let buildingName = self.addressInfo.buildingName.isEmpty ? "내가 설정한 출발지" : self.addressInfo.buildingName + + return DepartureLocationModel(departureName: buildingName, departureAddress: addressInfo.fullAddress, latitude: String(latitude), longitude: String(longitude)) + } +} + +// MARK: - AddressInfo +struct AddressInfo: Codable { + let fullAddress, addressType, cityDo, guGun: String + let eupMyun, adminDong, adminDongCode, legalDong: String + let legalDongCode, ri, bunji, roadName: String + let buildingIndex, buildingName, mappingDistance, roadCode: String + + enum CodingKeys: String, CodingKey { + case fullAddress, addressType + case cityDo = "city_do" + case guGun = "gu_gun" + case eupMyun = "eup_myun" + case adminDong, adminDongCode, legalDong, legalDongCode, ri, bunji, roadName, buildingIndex, buildingName, mappingDistance, roadCode + } +} diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift index 1b406290..46aba421 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift @@ -11,7 +11,8 @@ import Moya enum DepartureSearchingRouter { case getAddress(keyword: String) - case getLocationAddress(latitude: Double, longitude: Double) + case getLocationAddress(latitude: Double, longitude: Double) // kakao + case getLocationTmapAddress(latitude: Double, longitude: Double) // tmap } extension DepartureSearchingRouter: TargetType { @@ -19,10 +20,12 @@ extension DepartureSearchingRouter: TargetType { var urlString: String switch self { - case .getAddress(let keyword): + case .getAddress: urlString = Config.kakaoAddressBaseURL case .getLocationAddress: urlString = "https://dapi.kakao.com/v2/local/geo" + case .getLocationTmapAddress: + urlString = Config.tmapAddressBaseURL } guard let url = URL(string: urlString) else { @@ -37,12 +40,14 @@ extension DepartureSearchingRouter: TargetType { return "/keyword.json" case .getLocationAddress: return "/coord2address.json" + case .getLocationTmapAddress: + return "/reversegeocoding" } } var method: Moya.Method { switch self { - case .getAddress, .getLocationAddress: + case .getAddress, .getLocationAddress, .getLocationTmapAddress: return .get } } @@ -53,6 +58,8 @@ extension DepartureSearchingRouter: TargetType { return .requestParameters(parameters: ["query": keyword], encoding: URLEncoding.default) case .getLocationAddress(let latitude, let longitude): return .requestParameters(parameters: ["x": longitude, "y": latitude], encoding: URLEncoding.default) + case .getLocationTmapAddress(let latitude, let longitude): + return .requestParameters(parameters: ["lat": latitude, "lon":longitude, "addressType": "A04","appKey": Config.tmapAPIKey], encoding: URLEncoding.default) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 5f219a21..8aa24042 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -126,7 +126,7 @@ extension DepartureSearchVC { guard let latitude = locationManager.location?.coordinate.latitude, let longitude = locationManager.location?.coordinate.longitude else { return } - searchLocationAddress(latitude: latitude, longitude: longitude) + searchLocationTmapAddress(latitude: latitude, longitude: longitude) } else { locationManager.startUpdatingLocation() @@ -274,7 +274,38 @@ extension DepartureSearchVC { let status = result.statusCode if 200..<300 ~= status { do { - let responseDto = try result.map(DepartureAddressSearchingResponseDto.self) + let responseDto = try result.map(KakakoAddressSearchingResponseDto.self) + let courseDrawingVC = CourseDrawingVC() + + courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) + + courseDrawingVC.hidesBottomBarWhenPushed = true + self.navigationController?.pushViewController(courseDrawingVC, animated: true) + } catch { + print(error.localizedDescription) + } + } + if status >= 400 { + print("400 error") + } + case .failure(let error): + print(error.localizedDescription) + self.showToast(message: "네트워크 통신 실패") + } + } + } + + private func searchLocationTmapAddress(latitude: Double, longitude: Double) { + print("여기에 안들어오나?") + departureSearchingProvider + .request(.getLocationTmapAddress(latitude: latitude, longitude: longitude)) { [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(TmapAddressSearchingResponseDto.self) let courseDrawingVC = CourseDrawingVC() courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) From b641edfc7604387166dc8bbf6a0e0b2f2c80afd5 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Wed, 27 Sep 2023 16:40:38 +0900 Subject: [PATCH 08/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=84=A0=ED=83=9D=EC=8B=9C=20=EB=A7=88?= =?UTF-8?q?=EC=BB=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponents/MapView/RNMapView.swift | 20 +++++---- .../CourseDrawing/VC/CourseDrawingVC.swift | 41 ++++++++++++++++++- .../CourseDrawing/VC/DepartureSearchVC.swift | 20 +++++++-- 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index d76afa7e..96e28836 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -18,6 +18,7 @@ final class RNMapView: UIView { @Published var pathDistance: Double = 0 @Published var markerCount = 0 + static let shared = RN private let screenWidth = UIScreen.main.bounds.width private let screenHeight = UIScreen.main.bounds.height @@ -94,8 +95,11 @@ extension RNMapView { /// 지정 위치에 startMarker와 출발 infoWindow 생성 (기존의 startMarker는 제거) @discardableResult - func makeStartMarker(at location: NMGLatLng, withCameraMove: Bool = false) -> Self { - self.startMarker.position = location + func makeStartMarker(at location: NMGLatLng, withCameraMove: Bool = false, type: SelectedType) -> Self { + if type == .other { + self.startMarker.position = location + } + self.startMarker.mapView = self.map.mapView self.startMarker.showInfoWindow() if withCameraMove { @@ -141,7 +145,7 @@ extension RNMapView { func makeMarkersWithStartMarker(at locations: [NMGLatLng], moveCameraToStartMarker: Bool) -> Self { removeMarkers() if locations.count < 2 { return self } - makeStartMarker(at: locations[0], withCameraMove: moveCameraToStartMarker) + makeStartMarker(at: locations[0], withCameraMove: moveCameraToStartMarker, type: .other) locations[1...].forEach { location in makeMarker(at: location) } @@ -386,11 +390,11 @@ extension RNMapView: NMFMapViewCameraDelegate, NMFMapViewTouchDelegate { self.makeMarker(at: latlng) } - func mapView(_ mapView: NMFMapView, cameraDidChangeByReason reason: Int, animated: Bool) { - let locationOverlay = map.mapView.locationOverlay - if locationOverlay.icon != locationOverlayIcon { - setLocationOverlay() - } + func mapViewCameraIdle(_ mapView: NMFMapView) { + let latitude = mapView.cameraPosition.target.lat + let longitude = mapView.cameraPosition.target.lng + + print(latitude, longitude) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 2f1d6cb9..8bf8e086 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -20,6 +20,7 @@ final class CourseDrawingVC: UIViewController { var pathImage: UIImage? var distance: Float = 0.0 + var selectedType: SelectedType = .other private var cancelBag = CancelBag() @@ -102,6 +103,19 @@ final class CourseDrawingVC: UIViewController { private let completeButton = CustomButton(title: "완성하기").setEnabled(false) + private let startMarkUIImage = UIImageView().then { + $0.image = ImageLiterals.icMapDeparture + } + private let startLabelUIImage = UIImageView().then { + $0.image = ImageLiterals.icMapStart + } + private lazy var startMarkStackView = UIStackView().then { + $0.addArrangedSubviews(startLabelUIImage, startMarkUIImage) + $0.axis = .vertical + $0.alignment = .center + $0.spacing = 1 + } + // MARK: - View Life Cycle override func viewDidLoad() { @@ -111,6 +125,7 @@ final class CourseDrawingVC: UIViewController { self.setAddTarget() self.bindMapView() self.setNavigationGesture(false) +// self.setCourseDrawingType() } } @@ -121,7 +136,7 @@ extension CourseDrawingVC { self.departureLocationModel = model self.naviBar.setTextFieldText(text: model.departureName) - self.mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true) + self.mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true, type: self.selectedType) self.departureLocationLabel.text = model.departureName self.departureDetailLocationLabel.text = model.departureAddress } @@ -153,6 +168,13 @@ extension CourseDrawingVC { }.store(in: cancelBag) } +// private func setCourseDrawingType() { +// if self.selectedType == .map { +// mapView.setDrawMode(to: true) +// print("draw mode 설정 되었음") +// } +// } + private func setNavigationGesture(_ isEnabled: Bool) { navigationController?.interactivePopGestureRecognizer?.isEnabled = isEnabled } @@ -218,6 +240,7 @@ extension CourseDrawingVC { private func setLayout() { setHiddenViewsLayout() self.view.addSubviews(naviBarContainerStackView, mapView, departureInfoContainerView) + self.view.addSubview(startMarkStackView) self.departureInfoContainerView.addSubviews(departureLocationLabel, departureDetailLocationLabel, decideDepartureButton) view.bringSubviewToFront(naviBarContainerStackView) @@ -242,6 +265,21 @@ extension CourseDrawingVC { make.edges.equalToSuperview() } + startLabelUIImage.snp.makeConstraints { make in + make.height.equalTo(34) + make.width.equalTo(58) + } + startMarkUIImage.snp.makeConstraints { make in + make.height.width.equalTo(65) + } + + startMarkStackView.snp.makeConstraints { make in + make.height.equalTo(100) + make.width.equalTo(65) + make.centerX.equalToSuperview() + make.centerY.equalToSuperview().offset(-17) + } + departureInfoContainerView.snp.makeConstraints { make in make.leading.bottom.trailing.equalToSuperview() make.height.equalTo(172) @@ -375,3 +413,4 @@ extension CourseDrawingVC { } } } + diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 8aa24042..a7d11a44 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -11,6 +11,12 @@ import Combine import Moya import CoreLocation +// 현재 위치 | 검색 | 지도에서 선택 중 분기처리를 해주기 위함 +enum SelectedType { + case other + case map +} + final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { // MARK: - Properties @@ -20,6 +26,7 @@ final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { private var addressList = [KakaoAddressResult]() private var cancelBag = CancelBag() var locationManager = CLLocationManager() + var selectedType: SelectedType = .other // MARK: - UI Components @@ -104,11 +111,13 @@ extension DepartureSearchVC { private func setBinding() { selectDirectionView.gesture().sink { _ in + self.selectedType = .other self.setLocation() }.store(in: cancelBag) selectMapView.gesture().sink { _ in - + self.selectedType = .map + self.setLocation() }.store(in: cancelBag) } @@ -216,6 +225,7 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { let departureLocationModel = addressList[indexPath.item].toDepartureLocationModel() courseDrawingVC.setData(model: departureLocationModel) + courseDrawingVC.selectedType = .other courseDrawingVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(courseDrawingVC, animated: true) @@ -277,8 +287,9 @@ extension DepartureSearchVC { let responseDto = try result.map(KakakoAddressSearchingResponseDto.self) let courseDrawingVC = CourseDrawingVC() + courseDrawingVC.selectedType = self.selectedType courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) - + courseDrawingVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(courseDrawingVC, animated: true) } catch { @@ -307,9 +318,10 @@ extension DepartureSearchVC { do { let responseDto = try result.map(TmapAddressSearchingResponseDto.self) let courseDrawingVC = CourseDrawingVC() - + + courseDrawingVC.selectedType = self.selectedType courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) - + courseDrawingVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(courseDrawingVC, animated: true) } catch { From 0e733d9885df363c191b8064e117449cf3d25f5e Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Wed, 27 Sep 2023 20:34:13 +0900 Subject: [PATCH 09/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=A7=80=EB=8F=84=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EC=A0=95=EB=B3=B4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponents/MapView/RNMapView.swift | 9 ++- .../CourseDrawing/VC/CourseDrawingVC.swift | 64 +++++++++++++++---- .../CourseDrawing/VC/DepartureSearchVC.swift | 3 +- 3 files changed, 60 insertions(+), 16 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index 96e28836..199783c2 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -18,7 +18,9 @@ final class RNMapView: UIView { @Published var pathDistance: Double = 0 @Published var markerCount = 0 - static let shared = RN + + var eventSubject = PassthroughSubject, Never>() + private var selectedType: SelectedType = .other private let screenWidth = UIScreen.main.bounds.width private let screenHeight = UIScreen.main.bounds.height @@ -390,11 +392,12 @@ extension RNMapView: NMFMapViewCameraDelegate, NMFMapViewTouchDelegate { self.makeMarker(at: latlng) } + // 지도 이동 멈췄을 때 호출되는 메서드 func mapViewCameraIdle(_ mapView: NMFMapView) { let latitude = mapView.cameraPosition.target.lat let longitude = mapView.cameraPosition.target.lng - - print(latitude, longitude) + + eventSubject.send([latitude, longitude]) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 8bf8e086..7718165e 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -15,12 +15,19 @@ final class CourseDrawingVC: UIViewController { // MARK: - Properties private let courseProvider = Providers.courseProvider + private let departureSearchingProvider = Providers.departureSearchingProvider private var departureLocationModel: DepartureLocationModel? var pathImage: UIImage? var distance: Float = 0.0 - var selectedType: SelectedType = .other + + var courseDrawingEventSubject = PassthroughSubject() + lazy var selectedType: SelectedType = .other { + didSet { + courseDrawingEventSubject.send(selectedType) + } + } private var cancelBag = CancelBag() @@ -125,7 +132,6 @@ final class CourseDrawingVC: UIViewController { self.setAddTarget() self.bindMapView() self.setNavigationGesture(false) -// self.setCourseDrawingType() } } @@ -134,13 +140,19 @@ final class CourseDrawingVC: UIViewController { extension CourseDrawingVC { func setData(model: DepartureLocationModel) { self.departureLocationModel = model - self.naviBar.setTextFieldText(text: model.departureName) self.mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true, type: self.selectedType) self.departureLocationLabel.text = model.departureName self.departureDetailLocationLabel.text = model.departureAddress } + func updateData(model: DepartureLocationModel) { + self.departureLocationModel = model + self.naviBar.setTextFieldText(text: model.departureName) + 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) @@ -166,15 +178,13 @@ extension CourseDrawingVC { self.pathImage = image self.uploadCourseDrawing() }.store(in: cancelBag) + + mapView.eventSubject.sink { [weak self] arr in + guard let self = self else { return } + self.searchLocationTmapAddress(latitude: arr[0], longitude: arr[1]) + }.store(in: cancelBag) } -// private func setCourseDrawingType() { -// if self.selectedType == .map { -// mapView.setDrawMode(to: true) -// print("draw mode 설정 되었음") -// } -// } - private func setNavigationGesture(_ isEnabled: Bool) { navigationController?.interactivePopGestureRecognizer?.isEnabled = isEnabled } @@ -213,7 +223,13 @@ extension CourseDrawingVC { extension CourseDrawingVC { @objc private func decideDepartureButtonDidTap() { showHiddenViews(withDuration: 0.7) - + + if self.selectedType == .map { + startMarkStackView.isHidden = true + guard let model = self.departureLocationModel else { return } + mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true, type: .other) + } + mapView.setDrawMode(to: true) } @@ -235,6 +251,7 @@ extension CourseDrawingVC { self.naviBarForEditing.backgroundColor = .clear self.departureInfoContainerView.layer.applyShadow(alpha: 0.35, x: 0, y: 3, blur: 10) self.distanceContainerView.layer.applyShadow(alpha: 0.2, x: 2, y: 4, blur: 9) + self.startMarkStackView.isHidden = self.selectedType == .map ? false : true } private func setLayout() { @@ -412,5 +429,30 @@ extension CourseDrawingVC { } } } + + private func searchLocationTmapAddress(latitude: Double, longitude: Double) { + departureSearchingProvider + .request(.getLocationTmapAddress(latitude: latitude, longitude: longitude)) { [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(TmapAddressSearchingResponseDto.self) + self.updateData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) + } catch { + print(error.localizedDescription) + } + } + if status >= 400 { + print("400 error") + } + case .failure(let error): + print(error.localizedDescription) + self.showToast(message: "네트워크 통신 실패") + } + } + } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index a7d11a44..9adba413 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -11,7 +11,7 @@ import Combine import Moya import CoreLocation -// 현재 위치 | 검색 | 지도에서 선택 중 분기처리를 해주기 위함 +/// 현재 위치 | 검색 | 지도에서 선택 중 분기처리를 해주기 위함 enum SelectedType { case other case map @@ -307,7 +307,6 @@ extension DepartureSearchVC { } private func searchLocationTmapAddress(latitude: Double, longitude: Double) { - print("여기에 안들어오나?") departureSearchingProvider .request(.getLocationTmapAddress(latitude: latitude, longitude: longitude)) { [weak self] response in guard let self = self else { return } From 90a10bc280fd37332f6ab9b392f6d17e9d0760eb Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 10 Oct 2023 16:30:25 +0900 Subject: [PATCH 10/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=84=A0=ED=83=9D=ED=95=9C=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/UIComponents/MapView/RNMapView.swift | 16 +++++++++++++--- .../CourseDrawing/VC/CourseDrawingVC.swift | 10 +++------- .../CourseDrawing/VC/DepartureSearchVC.swift | 1 + 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index 199783c2..1a92a930 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -20,7 +20,11 @@ final class RNMapView: UIView { @Published var markerCount = 0 var eventSubject = PassthroughSubject, Never>() - private var selectedType: SelectedType = .other + var selectedType: SelectedType = .other { + didSet { + print("RNMapview:", selectedType) + } + } private let screenWidth = UIScreen.main.bounds.width private let screenHeight = UIScreen.main.bounds.height @@ -373,6 +377,10 @@ extension RNMapView { } } } + + func setSelectedType(type: SelectedType) { + self.selectedType = type + } } // MARK: - @objc Function @@ -396,8 +404,10 @@ extension RNMapView: NMFMapViewCameraDelegate, NMFMapViewTouchDelegate { func mapViewCameraIdle(_ mapView: NMFMapView) { let latitude = mapView.cameraPosition.target.lat let longitude = mapView.cameraPosition.target.lng - - eventSubject.send([latitude, longitude]) + + if self.selectedType == .map { + eventSubject.send([latitude, longitude]) + } } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 7718165e..eb2ef134 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -21,13 +21,7 @@ final class CourseDrawingVC: UIViewController { var pathImage: UIImage? var distance: Float = 0.0 - - var courseDrawingEventSubject = PassthroughSubject() - lazy var selectedType: SelectedType = .other { - didSet { - courseDrawingEventSubject.send(selectedType) - } - } + var selectedType: SelectedType = .other private var cancelBag = CancelBag() @@ -183,6 +177,8 @@ extension CourseDrawingVC { guard let self = self else { return } self.searchLocationTmapAddress(latitude: arr[0], longitude: arr[1]) }.store(in: cancelBag) + + mapView.setSelectedType(type: self.selectedType) } private func setNavigationGesture(_ isEnabled: Bool) { diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 9adba413..7a76585b 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -125,6 +125,7 @@ extension DepartureSearchVC { // MARK: - Location extension DepartureSearchVC { + /// 현재 위도, 경도에 따른 주소 받아오는 함수 private func setLocation() { locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest From 1f77f0f0d30b37576a3f9678301045e298b46dca Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 10 Oct 2023 18:06:33 +0900 Subject: [PATCH 11/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B0=94=ED=85=80=EC=8B=9C=ED=8A=B8=20UI?= =?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 --- .../CourseDrawing/VC/CourseDrawingVC.swift | 10 +- .../VC/CourseNameBottomSheetVC.swift | 167 ++++++++++++++++++ 2 files changed, 174 insertions(+), 3 deletions(-) create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index eb2ef134..d35bcdc1 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -102,7 +102,7 @@ final class CourseDrawingVC: UIViewController { $0.setImage(ImageLiterals.icCancel, for: .normal) } - private let completeButton = CustomButton(title: "완성하기").setEnabled(false) + private let completeButton = CustomButton(title: "다음으로").setEnabled(false) private let startMarkUIImage = UIImageView().then { $0.image = ImageLiterals.icMapDeparture @@ -233,9 +233,13 @@ extension CourseDrawingVC { mapView.undo() } + /// 다음으로 가기 버튼 여기 수정해야함~ @objc private func completeButtonDidTap() { - guard handleVisitor() else { return } - mapView.capturePathImage() +// guard handleVisitor() else { return } +// mapView.capturePathImage() + let bottomSheetVC = CourseNameBottomSheetVC() + bottomSheetVC.modalPresentationStyle = .overFullScreen + self.present(bottomSheetVC, animated: false) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift new file mode 100644 index 00000000..91ae5817 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift @@ -0,0 +1,167 @@ +// +// CourseNameBottomSheetVC.swift +// Runnect-iOS +// +// Created by Sojin Lee on 2023/10/10. +// + +import UIKit + +import Combine +import SnapKit +import Then + +final class CourseNameBottomSheetVC: UIViewController { + // MARK: - UI + private let backgroundView = UIView().then { + $0.backgroundColor = .black.withAlphaComponent(0.65) + } + + private let bottomSheetView = UIView().then { + $0.backgroundColor = .white + $0.roundCorners(cornerRadius: 16, maskedCorners: [.layerMaxXMinYCorner, .layerMinXMinYCorner]) + } + + private let lineView = UIView().then { + $0.backgroundColor = .g4 + $0.roundCorners(cornerRadius: 3, maskedCorners: [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner]) + } + + private let courseNameLabel = UILabel().then { + $0.text = "코스 이름" + $0.font = .h5 + } + + private let textfield = UITextField().then { + $0.layer.cornerRadius = 10 + $0.placeholder = "코스의 이름을 입력해 주세요" + $0.layer.borderWidth = 1 + $0.layer.borderColor = UIColor.g3.cgColor + $0.textAlignment = .center + $0.font = .b2 + } + + private let completeButton = CustomButton(title: "완료").setColor(bgColor: .m1, disableColor: .g3).then { + $0.isEnabled = false + } + + // MARK: - View Life Cycle + override func viewDidLoad() { + super.viewDidLoad() + self.setLayout() +// self.setAddTarget() + self.addKeyboardNotification() + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + showBottomSheet() + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + disappearBottomSheet() + } +} + +extension CourseNameBottomSheetVC { + private func setLayout() { + bottomSheetView.addSubviews(lineView,courseNameLabel, textfield, completeButton) + self.view.addSubviews(backgroundView, bottomSheetView) + + backgroundView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + + bottomSheetView.snp.makeConstraints { + $0.leading.trailing.bottom.equalToSuperview() + $0.height.equalTo(0) + } + + lineView.snp.makeConstraints { + $0.width.equalTo(41.5) + $0.height.equalTo(4) + $0.top.equalToSuperview().offset(14) + $0.centerX.equalToSuperview() + } + + courseNameLabel.snp.makeConstraints { + $0.top.equalTo(lineView.snp.bottom).offset(14) + $0.centerX.equalToSuperview() + } + + textfield.snp.makeConstraints { + $0.width.equalTo(358) + $0.height.equalTo(44) + $0.centerX.equalToSuperview() + $0.top.equalTo(courseNameLabel.snp.bottom).offset(18) + } + + completeButton.snp.makeConstraints { + $0.width.equalTo(358) + $0.height.equalTo(44) + $0.centerX.equalToSuperview() + $0.top.equalTo(textfield.snp.bottom).offset(10) + } + } + + // MARK: - 바텀시트 열릴 때 + private func showBottomSheet() { + bottomSheetView.snp.remakeConstraints { + $0.leading.trailing.bottom.equalToSuperview() + $0.height.equalTo(204) + } + + UIView.animate( + withDuration: 0.5, + animations: self.view.layoutIfNeeded + ) + } + + // MARK: - 바텀시트 닫힐 때 + private func disappearBottomSheet() { + bottomSheetView.snp.remakeConstraints { + $0.leading.trailing.bottom.equalToSuperview() + $0.height.equalTo(0) + } + + UIView.animate( + withDuration: 0.5, + animations: self.view.layoutIfNeeded + ) + } + +// private func addKeyboardNotification() { +// NotificationCenter.default.addObserver( +// self, +// selector: #selector(keyboardWillShow), +// name: UIResponder.keyboardWillShowNotification, +// object: nil +// ) +// +// NotificationCenter.default.addObserver( +// self, +// selector: #selector(keyboardWillHide), +// name: UIResponder.keyboardWillHideNotification, +// object: nil +// ) +// } +// +// @objc private func keyboardWillShow(_ notification: Notification) { +// if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { +// let keybaordRectangle = keyboardFrame.cgRectValue +// let keyboardHeight = keybaordRectangle.height +// bottomSheetView.frame.origin.y -= keyboardHeight +// } +// } +// +// @objc private func keyboardWillHide(_ notification: Notification) { +// if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { +// let keybaordRectangle = keyboardFrame.cgRectValue +// let keyboardHeight = keybaordRectangle.height +// bottomSheetView.frame.origin.y += keyboardHeight +// } +// } +} From c457fcfd6bca45d611b09d050f2d243280469c33 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Wed, 11 Oct 2023 16:45:37 +0900 Subject: [PATCH 12/22] =?UTF-8?q?[Feat]=20#191=20-=20textfield=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=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 | 4 + .../VC/CourseNameBottomSheetVC.swift | 107 ++++++++++++------ 2 files changed, 76 insertions(+), 35 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 8662ebec..17fce311 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 0AEBD608F3973389E8E1C6D6 /* Pods_Runnect_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */; }; + 234CB8092AD53C28004B3A56 /* CourseNameBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 234CB8082AD53C28004B3A56 /* CourseNameBottomSheetVC.swift */; }; 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; @@ -168,6 +169,7 @@ /* Begin PBXFileReference section */ 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runnect_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 234CB8082AD53C28004B3A56 /* CourseNameBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseNameBottomSheetVC.swift; sourceTree = ""; }; 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; @@ -679,6 +681,7 @@ CEEC6B392961C4F300D00E1E /* CourseDrawingHomeVC.swift */, CEC2A6912962BE2900160BF7 /* DepartureSearchVC.swift */, CE29D581296402B500F47542 /* CourseDrawingVC.swift */, + 234CB8082AD53C28004B3A56 /* CourseNameBottomSheetVC.swift */, ); path = VC; sourceTree = ""; @@ -1480,6 +1483,7 @@ CE40BB2D296808B00030ABCA /* DepartureSearchingRouter.swift in Sources */, CE15F5A4296C932E0023827C /* RunningModel.swift in Sources */, CE17F02D2961BBA100E1DED0 /* ColorLiterals.swift in Sources */, + 234CB8092AD53C28004B3A56 /* CourseNameBottomSheetVC.swift in Sources */, CEC2A68E2962AF2C00160BF7 /* RNMarker.swift in Sources */, CE6655D2295D862A00C64E12 /* Publisher+Driver.swift in Sources */, DA0587F22A05D54100B72869 /* EditCourseRequestDto.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift index 91ae5817..23c46345 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift @@ -11,7 +11,7 @@ import Combine import SnapKit import Then -final class CourseNameBottomSheetVC: UIViewController { +final class CourseNameBottomSheetVC: UIViewController, UITextFieldDelegate { // MARK: - UI private let backgroundView = UIView().then { $0.backgroundColor = .black.withAlphaComponent(0.65) @@ -49,19 +49,20 @@ final class CourseNameBottomSheetVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.setLayout() -// self.setAddTarget() + self.setDelegate() + self.setAddTarget() self.addKeyboardNotification() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - + showBottomSheet() } override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) - + disappearBottomSheet() } } @@ -133,35 +134,71 @@ extension CourseNameBottomSheetVC { ) } -// private func addKeyboardNotification() { -// NotificationCenter.default.addObserver( -// self, -// selector: #selector(keyboardWillShow), -// name: UIResponder.keyboardWillShowNotification, -// object: nil -// ) -// -// NotificationCenter.default.addObserver( -// self, -// selector: #selector(keyboardWillHide), -// name: UIResponder.keyboardWillHideNotification, -// object: nil -// ) -// } -// -// @objc private func keyboardWillShow(_ notification: Notification) { -// if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { -// let keybaordRectangle = keyboardFrame.cgRectValue -// let keyboardHeight = keybaordRectangle.height -// bottomSheetView.frame.origin.y -= keyboardHeight -// } -// } -// -// @objc private func keyboardWillHide(_ notification: Notification) { -// if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { -// let keybaordRectangle = keyboardFrame.cgRectValue -// let keyboardHeight = keybaordRectangle.height -// bottomSheetView.frame.origin.y += keyboardHeight -// } -// } + private func setAddTarget() { + self.textfield.addTarget(self, action: #selector(textFieldTextDidChange), for: .editingChanged) + self.completeButton.addTarget(self, action: #selector(completeButtonDidTap), for: .touchUpInside) + } + + private func setDelegate() { + textfield.delegate = self + } + + private func addKeyboardNotification() { + NotificationCenter.default.addObserver( + self, + selector: #selector(keyboardWillShow), + name: UIResponder.keyboardWillShowNotification, + object: nil + ) + + NotificationCenter.default.addObserver( + self, + selector: #selector(keyboardWillHide), + name: UIResponder.keyboardWillHideNotification, + object: nil + ) + } +} + +// MARK: - @obj function +extension CourseNameBottomSheetVC { + @objc private func completeButtonDidTap() { + print("버튼 눌렸음") + } + + @objc private func textFieldTextDidChange() { + guard let text = textfield.text else { return } + + completeButton.isEnabled = !text.isEmpty + textfield.layer.borderColor = !text.isEmpty ? UIColor.m1.cgColor : UIColor.g3.cgColor + } + + @objc private func keyboardWillShow(_ notification: Notification) { + if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { + let keybaordRectangle = keyboardFrame.cgRectValue + let keyboardHeight = keybaordRectangle.height + bottomSheetView.snp.remakeConstraints { + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(204) + $0.bottom.equalToSuperview().inset(keyboardHeight) + } + + UIView.animate( + withDuration: 0.3, + animations: self.view.layoutIfNeeded + ) + } + } + + @objc private func keyboardWillHide(_ notification: Notification) { + bottomSheetView.snp.remakeConstraints { + $0.leading.trailing.bottom.equalToSuperview() + $0.height.equalTo(204) + } + + UIView.animate( + withDuration: 0.3, + animations: self.view.layoutIfNeeded + ) + } } From e77759e19c1bb94111349dd92a11d9ee73d14a8c Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Thu, 9 Nov 2023 00:49:13 +0900 Subject: [PATCH 13/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=A3=BC=EC=84=9D=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 --- .../Global/UIComponents/MapView/RNMapView.swift | 7 ++----- .../CourseDrawing/VC/CourseDrawingVC.swift | 16 ++++++++++------ .../CourseDrawing/VC/DepartureSearchVC.swift | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index 1a92a930..cd0ca74f 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -20,11 +20,7 @@ final class RNMapView: UIView { @Published var markerCount = 0 var eventSubject = PassthroughSubject, Never>() - var selectedType: SelectedType = .other { - didSet { - print("RNMapview:", selectedType) - } - } + var selectedType: SelectedType = .other private let screenWidth = UIScreen.main.bounds.width private let screenHeight = UIScreen.main.bounds.height @@ -102,6 +98,7 @@ extension RNMapView { /// 지정 위치에 startMarker와 출발 infoWindow 생성 (기존의 startMarker는 제거) @discardableResult func makeStartMarker(at location: NMGLatLng, withCameraMove: Bool = false, type: SelectedType) -> Self { + /// 지도에서 선택한 경우 가상의 마커를 보여주기 때문에 분기처리 if type == .other { self.startMarker.position = location } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index d35bcdc1..530ff5d9 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -212,6 +212,12 @@ extension CourseDrawingVC { self.present(alertVC, animated: false) } + + /// 수정 필요 - 바텀시트에서 완료 버튼을 누른 경우 + /// 아래의 코드를 호출해주어야함 + /// guard let self = self else { return } + /// guard handleVisitor() else { return } + /// self.mapView.capturePathImage() } // MARK: - @objc Function @@ -233,13 +239,11 @@ extension CourseDrawingVC { mapView.undo() } - /// 다음으로 가기 버튼 여기 수정해야함~ + /// 수정 필요 - 다음으로 버튼 눌린 경우 호출될 함수 @objc private func completeButtonDidTap() { -// guard handleVisitor() else { return } -// mapView.capturePathImage() - let bottomSheetVC = CourseNameBottomSheetVC() - bottomSheetVC.modalPresentationStyle = .overFullScreen - self.present(bottomSheetVC, animated: false) +// let bottomSheetVC = CourseNameBottomSheetVC() +// bottomSheetVC.modalPresentationStyle = .overFullScreen +// self.present(bottomSheetVC, animated: false) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 7a76585b..88c84101 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -26,7 +26,7 @@ final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { private var addressList = [KakaoAddressResult]() private var cancelBag = CancelBag() var locationManager = CLLocationManager() - var selectedType: SelectedType = .other + private var selectedType: SelectedType = .other // MARK: - UI Components From 2b98db7f0b86227089a4f2a599259b332343a988 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Thu, 9 Nov 2023 00:49:50 +0900 Subject: [PATCH 14/22] =?UTF-8?q?[Del]=20#191=20-=20=EB=B0=94=ED=85=80?= =?UTF-8?q?=EC=8B=9C=ED=8A=B8VC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 4 - .../VC/CourseNameBottomSheetVC.swift | 204 ------------------ 2 files changed, 208 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 17fce311..8662ebec 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 0AEBD608F3973389E8E1C6D6 /* Pods_Runnect_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */; }; - 234CB8092AD53C28004B3A56 /* CourseNameBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 234CB8082AD53C28004B3A56 /* CourseNameBottomSheetVC.swift */; }; 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; @@ -169,7 +168,6 @@ /* Begin PBXFileReference section */ 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runnect_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 234CB8082AD53C28004B3A56 /* CourseNameBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseNameBottomSheetVC.swift; sourceTree = ""; }; 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; @@ -681,7 +679,6 @@ CEEC6B392961C4F300D00E1E /* CourseDrawingHomeVC.swift */, CEC2A6912962BE2900160BF7 /* DepartureSearchVC.swift */, CE29D581296402B500F47542 /* CourseDrawingVC.swift */, - 234CB8082AD53C28004B3A56 /* CourseNameBottomSheetVC.swift */, ); path = VC; sourceTree = ""; @@ -1483,7 +1480,6 @@ CE40BB2D296808B00030ABCA /* DepartureSearchingRouter.swift in Sources */, CE15F5A4296C932E0023827C /* RunningModel.swift in Sources */, CE17F02D2961BBA100E1DED0 /* ColorLiterals.swift in Sources */, - 234CB8092AD53C28004B3A56 /* CourseNameBottomSheetVC.swift in Sources */, CEC2A68E2962AF2C00160BF7 /* RNMarker.swift in Sources */, CE6655D2295D862A00C64E12 /* Publisher+Driver.swift in Sources */, DA0587F22A05D54100B72869 /* EditCourseRequestDto.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift deleted file mode 100644 index 23c46345..00000000 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseNameBottomSheetVC.swift +++ /dev/null @@ -1,204 +0,0 @@ -// -// CourseNameBottomSheetVC.swift -// Runnect-iOS -// -// Created by Sojin Lee on 2023/10/10. -// - -import UIKit - -import Combine -import SnapKit -import Then - -final class CourseNameBottomSheetVC: UIViewController, UITextFieldDelegate { - // MARK: - UI - private let backgroundView = UIView().then { - $0.backgroundColor = .black.withAlphaComponent(0.65) - } - - private let bottomSheetView = UIView().then { - $0.backgroundColor = .white - $0.roundCorners(cornerRadius: 16, maskedCorners: [.layerMaxXMinYCorner, .layerMinXMinYCorner]) - } - - private let lineView = UIView().then { - $0.backgroundColor = .g4 - $0.roundCorners(cornerRadius: 3, maskedCorners: [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner]) - } - - private let courseNameLabel = UILabel().then { - $0.text = "코스 이름" - $0.font = .h5 - } - - private let textfield = UITextField().then { - $0.layer.cornerRadius = 10 - $0.placeholder = "코스의 이름을 입력해 주세요" - $0.layer.borderWidth = 1 - $0.layer.borderColor = UIColor.g3.cgColor - $0.textAlignment = .center - $0.font = .b2 - } - - private let completeButton = CustomButton(title: "완료").setColor(bgColor: .m1, disableColor: .g3).then { - $0.isEnabled = false - } - - // MARK: - View Life Cycle - override func viewDidLoad() { - super.viewDidLoad() - self.setLayout() - self.setDelegate() - self.setAddTarget() - self.addKeyboardNotification() - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - showBottomSheet() - } - - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - - disappearBottomSheet() - } -} - -extension CourseNameBottomSheetVC { - private func setLayout() { - bottomSheetView.addSubviews(lineView,courseNameLabel, textfield, completeButton) - self.view.addSubviews(backgroundView, bottomSheetView) - - backgroundView.snp.makeConstraints { - $0.edges.equalToSuperview() - } - - bottomSheetView.snp.makeConstraints { - $0.leading.trailing.bottom.equalToSuperview() - $0.height.equalTo(0) - } - - lineView.snp.makeConstraints { - $0.width.equalTo(41.5) - $0.height.equalTo(4) - $0.top.equalToSuperview().offset(14) - $0.centerX.equalToSuperview() - } - - courseNameLabel.snp.makeConstraints { - $0.top.equalTo(lineView.snp.bottom).offset(14) - $0.centerX.equalToSuperview() - } - - textfield.snp.makeConstraints { - $0.width.equalTo(358) - $0.height.equalTo(44) - $0.centerX.equalToSuperview() - $0.top.equalTo(courseNameLabel.snp.bottom).offset(18) - } - - completeButton.snp.makeConstraints { - $0.width.equalTo(358) - $0.height.equalTo(44) - $0.centerX.equalToSuperview() - $0.top.equalTo(textfield.snp.bottom).offset(10) - } - } - - // MARK: - 바텀시트 열릴 때 - private func showBottomSheet() { - bottomSheetView.snp.remakeConstraints { - $0.leading.trailing.bottom.equalToSuperview() - $0.height.equalTo(204) - } - - UIView.animate( - withDuration: 0.5, - animations: self.view.layoutIfNeeded - ) - } - - // MARK: - 바텀시트 닫힐 때 - private func disappearBottomSheet() { - bottomSheetView.snp.remakeConstraints { - $0.leading.trailing.bottom.equalToSuperview() - $0.height.equalTo(0) - } - - UIView.animate( - withDuration: 0.5, - animations: self.view.layoutIfNeeded - ) - } - - private func setAddTarget() { - self.textfield.addTarget(self, action: #selector(textFieldTextDidChange), for: .editingChanged) - self.completeButton.addTarget(self, action: #selector(completeButtonDidTap), for: .touchUpInside) - } - - private func setDelegate() { - textfield.delegate = self - } - - private func addKeyboardNotification() { - NotificationCenter.default.addObserver( - self, - selector: #selector(keyboardWillShow), - name: UIResponder.keyboardWillShowNotification, - object: nil - ) - - NotificationCenter.default.addObserver( - self, - selector: #selector(keyboardWillHide), - name: UIResponder.keyboardWillHideNotification, - object: nil - ) - } -} - -// MARK: - @obj function -extension CourseNameBottomSheetVC { - @objc private func completeButtonDidTap() { - print("버튼 눌렸음") - } - - @objc private func textFieldTextDidChange() { - guard let text = textfield.text else { return } - - completeButton.isEnabled = !text.isEmpty - textfield.layer.borderColor = !text.isEmpty ? UIColor.m1.cgColor : UIColor.g3.cgColor - } - - @objc private func keyboardWillShow(_ notification: Notification) { - if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { - let keybaordRectangle = keyboardFrame.cgRectValue - let keyboardHeight = keybaordRectangle.height - bottomSheetView.snp.remakeConstraints { - $0.leading.trailing.equalToSuperview() - $0.height.equalTo(204) - $0.bottom.equalToSuperview().inset(keyboardHeight) - } - - UIView.animate( - withDuration: 0.3, - animations: self.view.layoutIfNeeded - ) - } - } - - @objc private func keyboardWillHide(_ notification: Notification) { - bottomSheetView.snp.remakeConstraints { - $0.leading.trailing.bottom.equalToSuperview() - $0.height.equalTo(204) - } - - UIView.animate( - withDuration: 0.3, - animations: self.view.layoutIfNeeded - ) - } -} From e7b6a3afb3b0801b6da00fc6d687b87015024179 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Thu, 9 Nov 2023 00:50:56 +0900 Subject: [PATCH 15/22] =?UTF-8?q?[Fix]=20#191=20-=20=EC=B9=B4=EC=B9=B4?= =?UTF-8?q?=EC=98=A4=20=EC=A3=BC=EC=86=8C=20=EC=B0=BE=EA=B8=B0=20api=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDrawing/VC/DepartureSearchVC.swift | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 88c84101..2bc2d144 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -276,37 +276,6 @@ extension DepartureSearchVC { } } - private func searchLocationAddress(latitude: Double, longitude: Double) { - departureSearchingProvider - .request(.getLocationAddress(latitude: latitude, longitude: longitude)) { [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(KakakoAddressSearchingResponseDto.self) - let courseDrawingVC = CourseDrawingVC() - - courseDrawingVC.selectedType = self.selectedType - courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) - - courseDrawingVC.hidesBottomBarWhenPushed = true - self.navigationController?.pushViewController(courseDrawingVC, animated: true) - } catch { - print(error.localizedDescription) - } - } - if status >= 400 { - print("400 error") - } - case .failure(let error): - print(error.localizedDescription) - self.showToast(message: "네트워크 통신 실패") - } - } - } - private func searchLocationTmapAddress(latitude: Double, longitude: Double) { departureSearchingProvider .request(.getLocationTmapAddress(latitude: latitude, longitude: longitude)) { [weak self] response in From 79aa6738f8a3b2974bb1d57c98f57f09a581a488 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Thu, 9 Nov 2023 01:15:47 +0900 Subject: [PATCH 16/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=84=A0=ED=83=9D=EB=90=9C=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EB=84=A4=EB=B9=84=EB=B0=94=20=EB=AC=B8=EA=B5=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/UIComponents/CustomNavigationBar.swift | 7 +++++++ .../Presentation/CourseDrawing/VC/CourseDrawingVC.swift | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift index 132cd403..88fcf77c 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomNavigationBar.swift @@ -160,6 +160,13 @@ extension CustomNavigationBar { self.reportButton.isHidden = true return self } + + @discardableResult + func changeTitleWithLeftButton(_ font: UIFont, _ color: UIColor) -> Self { + centerTitleLabel.font = font + centerTitleLabel.textColor = color + return self + } } // MARK: - @objc Function diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 530ff5d9..faa99c59 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -31,9 +31,10 @@ final class CourseDrawingVC: UIViewController { $0.backgroundColor = .w1 } - private lazy var naviBar = CustomNavigationBar(self, type: .search) - .setTextFieldText(text: "검색 결과") + private lazy var naviBar = CustomNavigationBar(self, type: self.selectedType == .map ? .titleWithLeftButton : .search) .hideRightButton() + .changeTitleWithLeftButton(.b1, .g1) + .setTitle("지도에서 선택") private lazy var naviBarForEditing = CustomNavigationBar(self, type: .titleWithLeftButton) .then { @@ -145,6 +146,10 @@ extension CourseDrawingVC { self.naviBar.setTextFieldText(text: model.departureName) self.departureLocationLabel.text = model.departureName self.departureDetailLocationLabel.text = model.departureAddress + + if self.selectedType == .other { + self.naviBar.setTextFieldText(text: model.departureName) + } } private func setAddTarget() { From 0e21db29bc133f608841a2658af7b810fde1b2cc Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Thu, 9 Nov 2023 01:43:17 +0900 Subject: [PATCH 17/22] =?UTF-8?q?[Feat]=20#191=20-=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=84=A0=ED=83=9D=EC=8B=9C=20=EC=95=88?= =?UTF-8?q?=EB=82=B4=20=EB=AC=B8=EA=B5=AC=20=EB=B7=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDrawing/VC/CourseDrawingVC.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index faa99c59..0b2085cb 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -49,6 +49,20 @@ final class CourseDrawingVC: UIViewController { $0.axis = .vertical } + private let underlineView = UIView().then { + $0.backgroundColor = .g4 + } + + private let aboutMapNoticeView = UIView().then { + $0.backgroundColor = .w1 + } + + private let aboutMapNoticeLabel = UILabel().then { + $0.font = .b4 + $0.textColor = .g2 + $0.text = "지도를 움직여 출발지를 설정해 주세요" + } + private let mapView = RNMapView().makeNaverLogoMargin(inset: UIEdgeInsets(top: 52, left: 0, bottom: 0, right: 0)) private let departureLocationLabel = UILabel().then { @@ -326,6 +340,25 @@ extension CourseDrawingVC { make.leading.trailing.equalToSuperview().inset(16) make.height.equalTo(44) } + + if self.selectedType == .map { + self.aboutMapNoticeView.addSubview(aboutMapNoticeLabel) + self.naviBarContainerStackView.addArrangedSubviews(underlineView,aboutMapNoticeView) + + underlineView.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(1) + } + + aboutMapNoticeView.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(32) + } + + aboutMapNoticeLabel.snp.makeConstraints { + $0.centerX.centerY.equalToSuperview() + } + } } private func setHiddenViewsLayout() { From 0b5232a73c63cd89752fdad0b4c63531fb5453c0 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Thu, 9 Nov 2023 01:46:56 +0900 Subject: [PATCH 18/22] =?UTF-8?q?[Feat]=20#191=20-=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Podfile.lock | 68 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Runnect-iOS/Podfile.lock b/Runnect-iOS/Podfile.lock index 5421d835..12f2d88d 100644 --- a/Runnect-iOS/Podfile.lock +++ b/Runnect-iOS/Podfile.lock @@ -1,36 +1,36 @@ PODS: - - Alamofire (5.7.1) + - Alamofire (5.8.1) - CombineCocoa (0.4.1) - - FirebaseCore (10.14.0): + - FirebaseCore (10.17.0): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Logger (~> 7.8) - - FirebaseCoreInternal (10.14.0): + - FirebaseCoreInternal (10.17.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - - FirebaseDynamicLinks (10.14.0): + - FirebaseDynamicLinks (10.17.0): - FirebaseCore (~> 10.0) - - GoogleUtilities/Environment (7.11.5): + - GoogleUtilities/Environment (7.12.0): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.11.5): + - GoogleUtilities/Logger (7.12.0): - GoogleUtilities/Environment - - "GoogleUtilities/NSData+zlib (7.11.5)" - - KakaoSDKAuth (2.16.0): - - KakaoSDKCommon (= 2.16.0) - - KakaoSDKCommon (2.16.0): - - KakaoSDKCommon/Common (= 2.16.0) - - KakaoSDKCommon/Network (= 2.16.0) - - KakaoSDKCommon/Common (2.16.0) - - KakaoSDKCommon/Network (2.16.0): + - "GoogleUtilities/NSData+zlib (7.12.0)" + - KakaoSDKAuth (2.18.2): + - KakaoSDKCommon (= 2.18.2) + - KakaoSDKCommon (2.18.2): + - KakaoSDKCommon/Common (= 2.18.2) + - KakaoSDKCommon/Network (= 2.18.2) + - KakaoSDKCommon/Common (2.18.2) + - KakaoSDKCommon/Network (2.18.2): - Alamofire (~> 5.1) - - KakaoSDKCommon/Common (= 2.16.0) - - KakaoSDKShare (2.16.0): - - KakaoSDKCommon (= 2.16.0) - - KakaoSDKTemplate (= 2.16.0) - - KakaoSDKTemplate (2.16.0): - - KakaoSDKCommon/Common (= 2.16.0) - - KakaoSDKUser (2.16.0): - - KakaoSDKAuth (= 2.16.0) - - Kingfisher (7.9.0) + - KakaoSDKCommon/Common (= 2.18.2) + - KakaoSDKShare (2.18.2): + - KakaoSDKCommon (= 2.18.2) + - KakaoSDKTemplate (= 2.18.2) + - KakaoSDKTemplate (2.18.2): + - KakaoSDKCommon/Common (= 2.18.2) + - KakaoSDKUser (2.18.2): + - KakaoSDKAuth (= 2.18.2) + - Kingfisher (7.10.0) - Moya (15.0.0): - Moya/Core (= 15.0.0) - Moya/Core (15.0.0): @@ -78,18 +78,18 @@ SPEC REPOS: - Then SPEC CHECKSUMS: - Alamofire: 0123a34370cb170936ae79a8df46cc62b2edeb88 + Alamofire: 3ca42e259043ee0dc5c0cdd76c4bc568b8e42af7 CombineCocoa: e5210dbfb480ff251078929459ac17e750e7af1d - FirebaseCore: 6fc17ac9f03509d51c131298aacb3ee5698b4f02 - FirebaseCoreInternal: d558159ee6cc4b823c2296ecc193de9f6d9a5bb3 - FirebaseDynamicLinks: 0eaabff2d0e5d0e576c0227227b00771aa2f3aaf - GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084 - KakaoSDKAuth: 1b85ed7c41b0517bfd1fc9dc46c292c75b8cb610 - KakaoSDKCommon: d6579aa2e9d963d74e13d741cbf1cce48b8b0c17 - KakaoSDKShare: efc0415c4f33274232604eeaf96fb03641facdca - KakaoSDKTemplate: 7e478a3cda6f5879b475546bfcd667b464fbb6d0 - KakaoSDKUser: 427e5b3884abd19ee6d9a7bd6e3f3029eb2968b8 - Kingfisher: 59f908b6d2f403b0a3e539debb0eec05cb27002c + FirebaseCore: 534544dd98cabcf4bf8598d88ec683b02319a528 + FirebaseCoreInternal: 2cf9202e226e3f78d2bf6d56c472686b935bfb7f + FirebaseDynamicLinks: 66878206d55d4aba6e63744f57151a80d76e472e + GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 + KakaoSDKAuth: 3daf72ec463876e0fe6d0d37c7d6b0b2729169f1 + KakaoSDKCommon: 516f68bc6b223ed502c34a362d6ecc9145e0dcc0 + KakaoSDKShare: 8980e83a3a80bd805ab859c102dd41ed6801424e + KakaoSDKTemplate: 0fcfbbb7cc05986fe6690b85e19dd8de0fc634e6 + KakaoSDKUser: 5b0826033381d314f550dd90fbf70d3612044ad6 + Kingfisher: a18f05d3b6d37d8650ee4a3e61d57a28fc6207f6 Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee NMapsGeometry: 53c573ead66466681cf123f99f698dc8071a4b83 NMapsMap: a5b909a31b6f3d27a670f6eb2ddc913c38975474 From 63bb06355c5f37d0e6927189db1872cccc301a46 Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Mon, 13 Nov 2023 23:10:00 +0900 Subject: [PATCH 19/22] =?UTF-8?q?[Fix]=20podfile=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xcode 14.3 버전에서 생기는 에러 수정을 위한 코드 --- Runnect-iOS/Podfile | 10 +++- Runnect-iOS/Podfile.lock | 53 ++++++++++--------- .../Runnect-iOS.xcodeproj/project.pbxproj | 4 +- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/Runnect-iOS/Podfile b/Runnect-iOS/Podfile index 8bdd5bca..861373ac 100644 --- a/Runnect-iOS/Podfile +++ b/Runnect-iOS/Podfile @@ -20,7 +20,15 @@ target 'Runnect-iOS' do pod 'DropDown', :git => 'https://github.com/thingineeer/DropDown.git', :commit => '95ee36f7bd925d466033c2c169979f1c574bf3b9' pod 'CombineCocoa' - +end # Pods for Runnect-iOS +post_install do |installer| + installer.generated_projects.each do |project| + project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' + end + end + end end diff --git a/Runnect-iOS/Podfile.lock b/Runnect-iOS/Podfile.lock index d8bbca51..327732e9 100644 --- a/Runnect-iOS/Podfile.lock +++ b/Runnect-iOS/Podfile.lock @@ -1,8 +1,8 @@ PODS: - Alamofire (5.8.1) - CombineCocoa (0.4.1) - - FirebaseCore (10.17.0): - DropDown (2.3.13) + - FirebaseCore (10.17.0): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Logger (~> 7.8) @@ -23,15 +23,18 @@ PODS: - KakaoSDKCommon/Common (2.18.2) - KakaoSDKCommon/Network (2.18.2): - Alamofire (~> 5.1) - - KakaoSDKCommon/Common (= 2.16.0) - - KakaoSDKShare (2.16.0): - - KakaoSDKCommon (= 2.16.0) - - KakaoSDKTemplate (= 2.16.0) - - KakaoSDKTemplate (2.16.0): - - KakaoSDKCommon/Common (= 2.16.0) - - KakaoSDKUser (2.16.0): - - KakaoSDKAuth (= 2.16.0) - - Kingfisher (7.9.0) + - KakaoSDKCommon/Common (= 2.18.2) + - KakaoSDKShare (2.18.2): + - KakaoSDKCommon (= 2.18.2) + - KakaoSDKTemplate (= 2.18.2) + - KakaoSDKTalk (2.18.2): + - KakaoSDKTemplate (= 2.18.2) + - KakaoSDKUser (= 2.18.2) + - KakaoSDKTemplate (2.18.2): + - KakaoSDKCommon/Common (= 2.18.2) + - KakaoSDKUser (2.18.2): + - KakaoSDKAuth (= 2.18.2) + - Kingfisher (7.10.0) - Moya (15.0.0): - Moya/Core (= 15.0.0) - Moya/Core (15.0.0): @@ -44,6 +47,8 @@ PODS: - Then (3.0.0) DEPENDENCIES: + - CombineCocoa + - DropDown (from `https://github.com/thingineeer/DropDown.git`, commit `95ee36f7bd925d466033c2c169979f1c574bf3b9`) - FirebaseDynamicLinks - KakaoSDKAuth - KakaoSDKCommon @@ -90,20 +95,20 @@ CHECKOUT OPTIONS: :git: https://github.com/thingineeer/DropDown.git SPEC CHECKSUMS: - Alamofire: 0123a34370cb170936ae79a8df46cc62b2edeb88 - DropDown: bf260fd688978138019ad7d94f63a2362dad85ba - FirebaseCore: 6fc17ac9f03509d51c131298aacb3ee5698b4f02 - FirebaseCoreInternal: d558159ee6cc4b823c2296ecc193de9f6d9a5bb3 - FirebaseDynamicLinks: 0eaabff2d0e5d0e576c0227227b00771aa2f3aaf - GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084 - KakaoSDKAuth: 1b85ed7c41b0517bfd1fc9dc46c292c75b8cb610 - KakaoSDKCommon: d6579aa2e9d963d74e13d741cbf1cce48b8b0c17 - KakaoSDKShare: efc0415c4f33274232604eeaf96fb03641facdca - KakaoSDKTalk: 44545bd9a1ebc144795eb6e927960b10cf8252f5 - KakaoSDKTemplate: 7e478a3cda6f5879b475546bfcd667b464fbb6d0 - KakaoSDKUser: 427e5b3884abd19ee6d9a7bd6e3f3029eb2968b8 - Kingfisher: 59f908b6d2f403b0a3e539debb0eec05cb27002c + Alamofire: 3ca42e259043ee0dc5c0cdd76c4bc568b8e42af7 CombineCocoa: e5210dbfb480ff251078929459ac17e750e7af1d + DropDown: bf260fd688978138019ad7d94f63a2362dad85ba + FirebaseCore: 534544dd98cabcf4bf8598d88ec683b02319a528 + FirebaseCoreInternal: 2cf9202e226e3f78d2bf6d56c472686b935bfb7f + FirebaseDynamicLinks: 66878206d55d4aba6e63744f57151a80d76e472e + GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 + KakaoSDKAuth: 3daf72ec463876e0fe6d0d37c7d6b0b2729169f1 + KakaoSDKCommon: 516f68bc6b223ed502c34a362d6ecc9145e0dcc0 + KakaoSDKShare: 8980e83a3a80bd805ab859c102dd41ed6801424e + KakaoSDKTalk: 567d2697b419b4f01f2f8bdb28e13100817c4090 + KakaoSDKTemplate: 0fcfbbb7cc05986fe6690b85e19dd8de0fc634e6 + KakaoSDKUser: 5b0826033381d314f550dd90fbf70d3612044ad6 + Kingfisher: a18f05d3b6d37d8650ee4a3e61d57a28fc6207f6 Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee NMapsGeometry: 53c573ead66466681cf123f99f698dc8071a4b83 NMapsMap: a5b909a31b6f3d27a670f6eb2ddc913c38975474 @@ -111,6 +116,6 @@ SPEC CHECKSUMS: SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25 Then: 844265ae87834bbe1147d91d5d41a404da2ec27d -PODFILE CHECKSUM: 9cec08e47233bfd653e7a2b2c95bde1b7426add8 +PODFILE CHECKSUM: a1846e0d9fa164fc8d0a63bb343a6b7ba18187b9 COCOAPODS: 1.12.1 diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 65ed071f..45403291 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ 23EE06D12AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; }; - 71DBF23E2ABB255A0013415B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 71DBF23D2ABB255A0013415B /* GoogleService-Info.plist */; }; A3305A97296EF58C000B1A10 /* GoalRewardInfoDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3305A96296EF58C000B1A10 /* GoalRewardInfoDto.swift */; }; A3BC2F2B2962C3D500198261 /* GoalRewardInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */; }; A3BC2F2D2962C3F200198261 /* ActivityRecordInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F2C2962C3F200198261 /* ActivityRecordInfoVC.swift */; }; @@ -168,6 +167,7 @@ /* Begin PBXFileReference section */ 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runnect_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2349CD512B024E5B00EE7C4A /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runnect-iOS/GoogleService-Info.plist"; sourceTree = ""; }; 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; @@ -797,6 +797,7 @@ CE4545BC295D7AF4003201E1 = { isa = PBXGroup; children = ( + 2349CD512B024E5B00EE7C4A /* GoogleService-Info.plist */, CE665614295D989A00C64E12 /* .swiftlint.yml */, CE4545C7295D7AF4003201E1 /* Runnect-iOS */, CE4545C6295D7AF4003201E1 /* Products */, @@ -1274,7 +1275,6 @@ files = ( CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */, CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */, - 71DBF23E2ABB255A0013415B /* GoogleService-Info.plist in Resources */, CE17F0352961BEF800E1DED0 /* Pretendard-SemiBold.otf in Resources */, CE17F0332961BEF800E1DED0 /* Pretendard-Medium.otf in Resources */, CE6655BF295D82E200C64E12 /* .gitkeep in Resources */, From 2ba2da7b8e6abcb4972c405b2a11e0a60a6d5df0 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Mon, 13 Nov 2023 23:51:00 +0900 Subject: [PATCH 20/22] =?UTF-8?q?[Fix]=20#191=20-=20project=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=A0=91=EA=B7=BC?= =?UTF-8?q?=EC=A0=9C=ED=95=9C=EC=9E=90=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj | 2 ++ .../Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift | 2 +- .../Presentation/CourseDrawing/VC/DepartureSearchVC.swift | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 45403291..7a520551 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 0AEBD608F3973389E8E1C6D6 /* Pods_Runnect_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 015778D02D5CDE0838284CD7 /* Pods_Runnect_iOS.framework */; }; + 2349CD532B026EA500EE7C4A /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2349CD512B024E5B00EE7C4A /* GoogleService-Info.plist */; }; 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; @@ -1273,6 +1274,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2349CD532B026EA500EE7C4A /* GoogleService-Info.plist in Resources */, CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */, CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */, CE17F0352961BEF800E1DED0 /* Pretendard-SemiBold.otf in Resources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index cd0ca74f..94aa7f21 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -20,7 +20,7 @@ final class RNMapView: UIView { @Published var markerCount = 0 var eventSubject = PassthroughSubject, Never>() - var selectedType: SelectedType = .other + private var selectedType: SelectedType = .other private let screenWidth = UIScreen.main.bounds.width private let screenHeight = UIScreen.main.bounds.height diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 2bc2d144..ae853b5f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -25,7 +25,7 @@ final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { private var addressList = [KakaoAddressResult]() private var cancelBag = CancelBag() - var locationManager = CLLocationManager() + private var locationManager = CLLocationManager() private var selectedType: SelectedType = .other // MARK: - UI Components From 1367f1f4c28bf5526f0114c966721a7a442c2b5a Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 14 Nov 2023 20:44:05 +0900 Subject: [PATCH 21/22] =?UTF-8?q?[Fix]=20#191=20-=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj | 8 ++++---- ...seDto.swift => KakaoAddressSearchingResponseDto.swift} | 2 +- .../Presentation/CourseDrawing/VC/DepartureSearchVC.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/{KakakoAddressSearchingResponseDto.swift => KakaoAddressSearchingResponseDto.swift} (97%) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 7a520551..6e8707da 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -12,7 +12,7 @@ 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; - 23EE06CB2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06CA2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift */; }; + 23EE06CB2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06CA2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift */; }; 23EE06D12AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; }; @@ -172,7 +172,7 @@ 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; - 23EE06CA2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakakoAddressSearchingResponseDto.swift; sourceTree = ""; }; + 23EE06CA2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoAddressSearchingResponseDto.swift; sourceTree = ""; }; 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TmapAddressSearchingResponseDto.swift; sourceTree = ""; }; 3C3033C911343B5C57EB68E7 /* Pods-Runnect-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runnect-iOS.debug.xcconfig"; path = "Target Support Files/Pods-Runnect-iOS/Pods-Runnect-iOS.debug.xcconfig"; sourceTree = ""; }; 7110A6032AA337DD009A7E99 /* Runnect-iOSDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Runnect-iOSDebug.entitlements"; sourceTree = ""; }; @@ -781,7 +781,7 @@ children = ( CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */, CE320F37296C8FAB009F89A7 /* CourseDrawingResponseData.swift */, - 23EE06CA2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift */, + 23EE06CA2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift */, 23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */, ); path = ResponseDto; @@ -1493,7 +1493,7 @@ CE102C4829DB1D6B00E23E69 /* GetNewTokenResponseDto.swift in Sources */, CE6655CA295D84DD00C64E12 /* UserDefaultKeyList.swift in Sources */, 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */, - 23EE06CB2AC2AF3E00CB3FF8 /* KakakoAddressSearchingResponseDto.swift in Sources */, + 23EE06CB2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift in Sources */, CE6655F2295D894D00C64E12 /* UIView+.swift in Sources */, CE9291252965C9FB0010959C /* CourseDetailInfoView.swift in Sources */, CE665600295D915D00C64E12 /* getClassName.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakakoAddressSearchingResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakaoAddressSearchingResponseDto.swift similarity index 97% rename from Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakakoAddressSearchingResponseDto.swift rename to Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakaoAddressSearchingResponseDto.swift index aa67dec3..af288f89 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakakoAddressSearchingResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/CourseDrawingDto/ResponseDto/KakaoAddressSearchingResponseDto.swift @@ -8,7 +8,7 @@ import Foundation // MARK: - DepartureAddressSearchingResponseDto -struct KakakoAddressSearchingResponseDto: Codable { +struct KakaoAddressSearchingResponseDto: Codable { let meta: Meta let documents: [Document] diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index ae853b5f..1045b766 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -170,7 +170,7 @@ extension DepartureSearchVC { locationSelectStackView.snp.makeConstraints { make in make.top.equalTo(dividerView.snp.bottom) make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(8) - make.height.equalTo(52) + make.height.equalTo(50) } selectDirectionView.snp.makeConstraints { make in From 4c5966f96b42d18232cff9a02fde3ab09832e922 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Tue, 14 Nov 2023 21:40:52 +0900 Subject: [PATCH 22/22] =?UTF-8?q?[Fix]=20#191=20-=20=EC=8B=B1=EA=B8=80?= =?UTF-8?q?=ED=86=A4=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 지도 선택 | 검색 | 현재 위치 설정 하는 경우는 세 개의 파일에서 사용되기 때문에 싱글톤으로 수정하였습니다 --- .../Global/UIComponents/MapView/RNMapView.swift | 13 ++++--------- .../DepartureSearchingRouter.swift | 13 +++++++++++++ .../CourseDrawing/VC/CourseDrawingVC.swift | 17 +++++++---------- .../CourseDrawing/VC/DepartureSearchVC.swift | 14 +++----------- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index 94aa7f21..1f72ab51 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -20,7 +20,6 @@ final class RNMapView: UIView { @Published var markerCount = 0 var eventSubject = PassthroughSubject, Never>() - private var selectedType: SelectedType = .other private let screenWidth = UIScreen.main.bounds.width private let screenHeight = UIScreen.main.bounds.height @@ -97,9 +96,9 @@ extension RNMapView { /// 지정 위치에 startMarker와 출발 infoWindow 생성 (기존의 startMarker는 제거) @discardableResult - func makeStartMarker(at location: NMGLatLng, withCameraMove: Bool = false, type: SelectedType) -> Self { + func makeStartMarker(at location: NMGLatLng, withCameraMove: Bool = false) -> Self { /// 지도에서 선택한 경우 가상의 마커를 보여주기 때문에 분기처리 - if type == .other { + if SelectedInfo.shared.type == .other { self.startMarker.position = location } @@ -148,7 +147,7 @@ extension RNMapView { func makeMarkersWithStartMarker(at locations: [NMGLatLng], moveCameraToStartMarker: Bool) -> Self { removeMarkers() if locations.count < 2 { return self } - makeStartMarker(at: locations[0], withCameraMove: moveCameraToStartMarker, type: .other) + makeStartMarker(at: locations[0], withCameraMove: moveCameraToStartMarker) locations[1...].forEach { location in makeMarker(at: location) } @@ -374,10 +373,6 @@ extension RNMapView { } } } - - func setSelectedType(type: SelectedType) { - self.selectedType = type - } } // MARK: - @objc Function @@ -402,7 +397,7 @@ extension RNMapView: NMFMapViewCameraDelegate, NMFMapViewTouchDelegate { let latitude = mapView.cameraPosition.target.lat let longitude = mapView.cameraPosition.target.lng - if self.selectedType == .map { + if SelectedInfo.shared.type == .map { eventSubject.send([latitude, longitude]) } } diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift index 46aba421..4d55a07e 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseDrawingRouter/DepartureSearchingRouter.swift @@ -15,6 +15,19 @@ enum DepartureSearchingRouter { case getLocationTmapAddress(latitude: Double, longitude: Double) // tmap } +/// 현재 위치 | 검색 | 지도에서 선택 중 분기처리를 해주기 위함 +enum SelectedType { + case other + case map +} + +final class SelectedInfo { + static let shared = SelectedInfo() + var type: SelectedType = .other + + private init() {} +} + extension DepartureSearchingRouter: TargetType { var baseURL: URL { var urlString: String diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 0b2085cb..d387214f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -21,7 +21,6 @@ final class CourseDrawingVC: UIViewController { var pathImage: UIImage? var distance: Float = 0.0 - var selectedType: SelectedType = .other private var cancelBag = CancelBag() @@ -31,7 +30,7 @@ final class CourseDrawingVC: UIViewController { $0.backgroundColor = .w1 } - private lazy var naviBar = CustomNavigationBar(self, type: self.selectedType == .map ? .titleWithLeftButton : .search) + private lazy var naviBar = CustomNavigationBar(self, type: SelectedInfo.shared.type == .map ? .titleWithLeftButton : .search) .hideRightButton() .changeTitleWithLeftButton(.b1, .g1) .setTitle("지도에서 선택") @@ -150,7 +149,7 @@ extension CourseDrawingVC { func setData(model: DepartureLocationModel) { self.departureLocationModel = model self.naviBar.setTextFieldText(text: model.departureName) - self.mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true, type: self.selectedType) + self.mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true) self.departureLocationLabel.text = model.departureName self.departureDetailLocationLabel.text = model.departureAddress } @@ -161,7 +160,7 @@ extension CourseDrawingVC { self.departureLocationLabel.text = model.departureName self.departureDetailLocationLabel.text = model.departureAddress - if self.selectedType == .other { + if SelectedInfo.shared.type == .other { self.naviBar.setTextFieldText(text: model.departureName) } } @@ -196,8 +195,6 @@ extension CourseDrawingVC { guard let self = self else { return } self.searchLocationTmapAddress(latitude: arr[0], longitude: arr[1]) }.store(in: cancelBag) - - mapView.setSelectedType(type: self.selectedType) } private func setNavigationGesture(_ isEnabled: Bool) { @@ -245,10 +242,10 @@ extension CourseDrawingVC { @objc private func decideDepartureButtonDidTap() { showHiddenViews(withDuration: 0.7) - if self.selectedType == .map { + if SelectedInfo.shared.type == .map { startMarkStackView.isHidden = true guard let model = self.departureLocationModel else { return } - mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true, type: .other) + mapView.makeStartMarker(at: model.toNMGLatLng(), withCameraMove: true) } mapView.setDrawMode(to: true) @@ -274,7 +271,7 @@ extension CourseDrawingVC { self.naviBarForEditing.backgroundColor = .clear self.departureInfoContainerView.layer.applyShadow(alpha: 0.35, x: 0, y: 3, blur: 10) self.distanceContainerView.layer.applyShadow(alpha: 0.2, x: 2, y: 4, blur: 9) - self.startMarkStackView.isHidden = self.selectedType == .map ? false : true + self.startMarkStackView.isHidden = SelectedInfo.shared.type == .map ? false : true } private func setLayout() { @@ -341,7 +338,7 @@ extension CourseDrawingVC { make.height.equalTo(44) } - if self.selectedType == .map { + if SelectedInfo.shared.type == .map { self.aboutMapNoticeView.addSubview(aboutMapNoticeLabel) self.naviBarContainerStackView.addArrangedSubviews(underlineView,aboutMapNoticeView) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift index 1045b766..1365441f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/DepartureSearchVC.swift @@ -11,12 +11,6 @@ import Combine import Moya import CoreLocation -/// 현재 위치 | 검색 | 지도에서 선택 중 분기처리를 해주기 위함 -enum SelectedType { - case other - case map -} - final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { // MARK: - Properties @@ -26,7 +20,6 @@ final class DepartureSearchVC: UIViewController, CLLocationManagerDelegate { private var addressList = [KakaoAddressResult]() private var cancelBag = CancelBag() private var locationManager = CLLocationManager() - private var selectedType: SelectedType = .other // MARK: - UI Components @@ -111,12 +104,12 @@ extension DepartureSearchVC { private func setBinding() { selectDirectionView.gesture().sink { _ in - self.selectedType = .other + SelectedInfo.shared.type = .other self.setLocation() }.store(in: cancelBag) selectMapView.gesture().sink { _ in - self.selectedType = .map + SelectedInfo.shared.type = .map self.setLocation() }.store(in: cancelBag) } @@ -226,7 +219,7 @@ extension DepartureSearchVC: UITableViewDelegate, UITableViewDataSource { let departureLocationModel = addressList[indexPath.item].toDepartureLocationModel() courseDrawingVC.setData(model: departureLocationModel) - courseDrawingVC.selectedType = .other + SelectedInfo.shared.type = .other courseDrawingVC.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(courseDrawingVC, animated: true) @@ -288,7 +281,6 @@ extension DepartureSearchVC { let responseDto = try result.map(TmapAddressSearchingResponseDto.self) let courseDrawingVC = CourseDrawingVC() - courseDrawingVC.selectedType = self.selectedType courseDrawingVC.setData(model: responseDto.toDepartureLocationModel(latitude: latitude, longitude: longitude)) courseDrawingVC.hidesBottomBarWhenPushed = true