Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ffd8ada
[Add] #191 - 아이콘 추가
513sojin Sep 25, 2023
074eba6
[Feat] #191 - 현재 위치 혹은 지도 선택 UI 구현
513sojin Sep 25, 2023
58b23f5
[Feat] #191 - BaseView 추가
513sojin Sep 25, 2023
442c834
[Feat] #191 - combineCocoa 설치
513sojin Sep 25, 2023
bb600b2
[Feat] #191 - view에 tapgesture 추가
513sojin Sep 25, 2023
1a8cb86
[Feat] #191 - 위도 경도에 따른 주소 가져오는 api 연결
513sojin Sep 26, 2023
f261df1
[Feat] #191 - tmap api 연결
513sojin Sep 26, 2023
b641edf
[Feat] #191 - 지도에서 선택시 마커 추가
513sojin Sep 27, 2023
0e733d9
[Feat] #191 - 지도 위치에 따라 위치 정보 변경
513sojin Sep 27, 2023
90a10bc
[Feat] #191 - 지도에서 선택한 경우 분기처리
513sojin Oct 10, 2023
1f77f0f
[Feat] #191 - 코스 이름 바텀시트 UI 구현
513sojin Oct 10, 2023
c457fcf
[Feat] #191 - textfield 이벤트 추가
513sojin Oct 11, 2023
ed1874c
Merge branch 'develop' into #191-위치선택
513sojin Oct 11, 2023
e77759e
[Feat] #191 - 주석 추가
513sojin Nov 8, 2023
2b98db7
[Del] #191 - 바텀시트VC 삭제
513sojin Nov 8, 2023
e7b6a3a
[Fix] #191 - 카카오 주소 찾기 api 삭제
513sojin Nov 8, 2023
79aa673
[Feat] #191 - 지도에서 선택된 경우 네비바 문구 수정
513sojin Nov 8, 2023
0e21db2
[Feat] #191 - 지도에서 선택시 안내 문구 뷰 추가
513sojin Nov 8, 2023
0b5232a
[Feat] #191 - 라이브러리 업데이트
513sojin Nov 8, 2023
02c6365
Merge branch 'develop' into #191-위치선택
513sojin Nov 8, 2023
78c4a15
Merge branch 'develop' into #191-위치선택
513sojin Nov 13, 2023
63bb063
[Fix] podfile 수정
513sojin Nov 13, 2023
2ba2da7
[Fix] #191 - project 파일 변경 및 접근제한자 수정
513sojin Nov 13, 2023
1367f1f
[Fix] #191 - 코드리뷰 반영
513sojin Nov 14, 2023
4c5966f
[Fix] #191 - 싱글톤으로 수정
513sojin Nov 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Runnect-iOS/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ target 'Runnect-iOS' do
pod 'FirebaseDynamicLinks'
pod 'KakaoSDKTalk'
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
82 changes: 43 additions & 39 deletions Runnect-iOS/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
PODS:
- Alamofire (5.7.1)
- Alamofire (5.8.1)
- CombineCocoa (0.4.1)
- DropDown (2.3.13)
- 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)
- KakaoSDKTalk (2.16.0):
- KakaoSDKTemplate (= 2.16.0)
- KakaoSDKUser (= 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):
Expand All @@ -46,6 +47,7 @@ PODS:
- Then (3.0.0)

DEPENDENCIES:
- CombineCocoa
- DropDown (from `https://github.com/thingineeer/DropDown.git`, commit `95ee36f7bd925d466033c2c169979f1c574bf3b9`)
- FirebaseDynamicLinks
- KakaoSDKAuth
Expand All @@ -63,6 +65,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- Alamofire
- CombineCocoa
- FirebaseCore
- FirebaseCoreInternal
- FirebaseDynamicLinks
Expand Down Expand Up @@ -92,26 +95,27 @@ CHECKOUT OPTIONS:
:git: https://github.com/thingineeer/DropDown.git

SPEC CHECKSUMS:
Alamofire: 0123a34370cb170936ae79a8df46cc62b2edeb88
Alamofire: 3ca42e259043ee0dc5c0cdd76c4bc568b8e42af7
CombineCocoa: e5210dbfb480ff251078929459ac17e750e7af1d
DropDown: bf260fd688978138019ad7d94f63a2362dad85ba
FirebaseCore: 6fc17ac9f03509d51c131298aacb3ee5698b4f02
FirebaseCoreInternal: d558159ee6cc4b823c2296ecc193de9f6d9a5bb3
FirebaseDynamicLinks: 0eaabff2d0e5d0e576c0227227b00771aa2f3aaf
GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084
KakaoSDKAuth: 1b85ed7c41b0517bfd1fc9dc46c292c75b8cb610
KakaoSDKCommon: d6579aa2e9d963d74e13d741cbf1cce48b8b0c17
KakaoSDKShare: efc0415c4f33274232604eeaf96fb03641facdca
KakaoSDKTalk: 44545bd9a1ebc144795eb6e927960b10cf8252f5
KakaoSDKTemplate: 7e478a3cda6f5879b475546bfcd667b464fbb6d0
KakaoSDKUser: 427e5b3884abd19ee6d9a7bd6e3f3029eb2968b8
Kingfisher: 59f908b6d2f403b0a3e539debb0eec05cb27002c
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
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
Then: 844265ae87834bbe1147d91d5d41a404da2ec27d

PODFILE CHECKSUM: 5bd73b39108f7bc1302e8303d79fefc7783805a5
PODFILE CHECKSUM: a1846e0d9fa164fc8d0a63bb343a6b7ba18187b9

COCOAPODS: 1.12.1
34 changes: 32 additions & 2 deletions Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@

/* 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 */; };
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 */; };
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 */; };
Expand Down Expand Up @@ -163,6 +168,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; };
2349CD512B024E5B00EE7C4A /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runnect-iOS/GoogleService-Info.plist"; sourceTree = "<group>"; };
23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = "<group>"; };
23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = "<group>"; };
23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = "<group>"; };
23EE06CA2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoAddressSearchingResponseDto.swift; sourceTree = "<group>"; };
23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TmapAddressSearchingResponseDto.swift; sourceTree = "<group>"; };
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 = "<group>"; };
7110A6032AA337DD009A7E99 /* Runnect-iOSDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Runnect-iOSDebug.entitlements"; sourceTree = "<group>"; };
712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -343,6 +354,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
23EE06C32AC1AE0600CB3FF8 /* Base */ = {
isa = PBXGroup;
children = (
23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */,
);
path = Base;
sourceTree = "<group>";
};
3F7098551CF7A77F3FE7EB2B /* Pods */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -669,6 +688,7 @@
isa = PBXGroup;
children = (
CEB8416D2962C45300BF8080 /* LocationSearchResultTVC.swift */,
23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -761,6 +781,8 @@
children = (
CE10065429680F7000FD31FB /* DepartureSearchingResponseDto.swift */,
CE320F37296C8FAB009F89A7 /* CourseDrawingResponseData.swift */,
23EE06CA2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift */,
23EE06D02AC2F44E00CB3FF8 /* TmapAddressSearchingResponseDto.swift */,
);
path = ResponseDto;
sourceTree = "<group>";
Expand All @@ -776,6 +798,7 @@
CE4545BC295D7AF4003201E1 = {
isa = PBXGroup;
children = (
2349CD512B024E5B00EE7C4A /* GoogleService-Info.plist */,
CE665614295D989A00C64E12 /* .swiftlint.yml */,
CE4545C7295D7AF4003201E1 /* Runnect-iOS */,
CE4545C6295D7AF4003201E1 /* Products */,
Expand Down Expand Up @@ -884,6 +907,7 @@
CE6655AA295D7FAE00C64E12 /* Global */ = {
isa = PBXGroup;
children = (
23EE06C32AC1AE0600CB3FF8 /* Base */,
CE6655B6295D803C00C64E12 /* UIComponents */,
CE6655B5295D803800C64E12 /* Literal */,
CE6655B4295D803400C64E12 /* Resource */,
Expand Down Expand Up @@ -991,6 +1015,7 @@
CE58759F29601500005D967E /* Toast.swift */,
CE6655C9295D84DD00C64E12 /* UserDefaultKeyList.swift */,
CE29D583296416D800F47542 /* caculateStatusBarHeight.swift */,
23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -1249,9 +1274,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2349CD532B026EA500EE7C4A /* GoogleService-Info.plist in Resources */,
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 */,
Expand Down Expand Up @@ -1343,6 +1368,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 */,
Expand Down Expand Up @@ -1398,15 +1424,18 @@
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 */,
CE18E890296C76C100FEB569 /* RNLocationModel.swift in Sources */,
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 */,
A3C38FED2A13212300FF196D /* SetInfoLayout.swift in Sources */,
CE6655D4295D865B00C64E12 /* Publisher+UIControl.swift in Sources */,
CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */,
Expand Down Expand Up @@ -1464,6 +1493,7 @@
CE102C4829DB1D6B00E23E69 /* GetNewTokenResponseDto.swift in Sources */,
CE6655CA295D84DD00C64E12 /* UserDefaultKeyList.swift in Sources */,
712F661D2A7B7BAB00D9539B /* Config.swift in Sources */,
23EE06CB2AC2AF3E00CB3FF8 /* KakaoAddressSearchingResponseDto.swift in Sources */,
CE6655F2295D894D00C64E12 /* UIView+.swift in Sources */,
CE9291252965C9FB0010959C /* CourseDetailInfoView.swift in Sources */,
CE665600295D915D00C64E12 /* getClassName.swift in Sources */,
Expand Down
41 changes: 41 additions & 0 deletions Runnect-iOS/Runnect-iOS/Global/Base/BaseView.swift
Original file line number Diff line number Diff line change
@@ -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() { }
}

Comment on lines +1 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오.. 리팩터링할때 정말 유용할 것 같습니다 👍👍👍

Original file line number Diff line number Diff line change
@@ -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<S>(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<S: Subscriber>: 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)
}
}
}
Loading