From 188cfbf46e678a1279643fbfe08ccfb539ead795 Mon Sep 17 00:00:00 2001 From: kawoou Date: Tue, 9 Jan 2018 21:51:30 +0900 Subject: [PATCH 1/2] Support RxSwift --- .gitignore | 2 + DrawerController/DrawerController.swift | 44 +----- DrawerController/Rx/DrawerController+Rx.swift | 129 ++++++++++++++++++ .../Rx/RxDrawerControllerDelegateProxy.swift | 47 +++++++ DrawerController/Types/DrawerSide.swift | 11 ++ Example/Conroller/MainViewController.swift | 48 ++++++- .../project.pbxproj | 101 ++++++++++++++ .../contents.xcworkspacedata | 10 ++ Example/Podfile | 11 ++ Example/Podfile.lock | 16 +++ KWDrawerController.podspec | 25 +++- 11 files changed, 398 insertions(+), 46 deletions(-) create mode 100644 DrawerController/Rx/DrawerController+Rx.swift create mode 100644 DrawerController/Rx/RxDrawerControllerDelegateProxy.swift create mode 100644 Example/KWDrawerController-Example.xcworkspace/contents.xcworkspacedata create mode 100644 Example/Podfile create mode 100644 Example/Podfile.lock diff --git a/.gitignore b/.gitignore index 9035e92..da66890 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,5 @@ fastlane/screenshots fastlane/test_output *.swp + +Pods/ diff --git a/DrawerController/DrawerController.swift b/DrawerController/DrawerController.swift index 97d6969..2f3a335 100644 --- a/DrawerController/DrawerController.swift +++ b/DrawerController/DrawerController.swift @@ -26,44 +26,12 @@ import UIKit @objc public protocol DrawerControllerDelegate { - - @objc - optional func drawerDidAnimation( - drawerController: DrawerController, - side: DrawerSide, - percentage: Float - ) - - @objc - optional func drawerDidBeganAnimation( - drawerController: DrawerController, - side: DrawerSide - ) - - @objc - optional func drawerWillFinishAnimation( - drawerController: DrawerController, - side: DrawerSide - ) - - @objc - optional func drawerWillCancelAnimation( - drawerController: DrawerController, - side: DrawerSide - ) - - @objc - optional func drawerDidFinishAnimation( - drawerController: DrawerController, - side: DrawerSide - ) - - @objc - optional func drawerDidCancelAnimation( - drawerController: DrawerController, - side: DrawerSide - ) - + @objc optional func drawerDidAnimation(drawerController: DrawerController, side: DrawerSide, percentage: Float) + @objc optional func drawerDidBeganAnimation(drawerController: DrawerController, side: DrawerSide) + @objc optional func drawerWillFinishAnimation(drawerController: DrawerController, side: DrawerSide) + @objc optional func drawerWillCancelAnimation(drawerController: DrawerController, side: DrawerSide) + @objc optional func drawerDidFinishAnimation(drawerController: DrawerController, side: DrawerSide) + @objc optional func drawerDidCancelAnimation(drawerController: DrawerController, side: DrawerSide) } open class DrawerController: UIViewController, UIGestureRecognizerDelegate { diff --git a/DrawerController/Rx/DrawerController+Rx.swift b/DrawerController/Rx/DrawerController+Rx.swift new file mode 100644 index 0000000..50233d5 --- /dev/null +++ b/DrawerController/Rx/DrawerController+Rx.swift @@ -0,0 +1,129 @@ +/* + The MIT License (MIT) + + Copyright (c) 2017 Kawoou (Jungwon An) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +import RxCocoa +import RxSwift + +// Taken from RxCococa until marked as public +func castOrThrow(_ resultType: DrawerSide.Type, _ object: Any) throws -> DrawerSide { + let rawValue = try castOrThrow(Int.self, object) + guard let returnValue = DrawerSide(rawValue: rawValue) else { + throw RxCocoaError.castingError(object: object, targetType: resultType) + } + return returnValue +} +func castOrThrow(_ resultType: T.Type, _ object: Any) throws -> T { + guard let returnValue = object as? T else { + throw RxCocoaError.castingError(object: object, targetType: resultType) + } + return returnValue +} + +public extension DrawerController { + public func openSide(_ side: DrawerSide) -> Completable { + return .create { [weak self] completable -> Disposable in + guard let ss = self else { + completable(.error(RxCocoaError.unknown)) + return Disposables.create() + } + ss.openSide(side) { + completable(.completed) + } + return Disposables.create() + } + } + public func closeSide() -> Completable { + return .create { [weak self] completable -> Disposable in + guard let ss = self else { + completable(.error(RxCocoaError.unknown)) + return Disposables.create() + } + ss.closeSide() { + completable(.completed) + } + return Disposables.create() + } + } +} + +extension Reactive where Base: DrawerController { + + /** + Reactive wrapper for `delegate`. + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var delegate: DelegateProxy { + return RxDrawerControllerDelegateProxy.proxy(for: base) + } + + public typealias AnimationPercent = (side: DrawerSide, percent: Float) + public var didAnimation: ControlEvent { + let source = delegate + .methodInvoked(#selector(DrawerControllerDelegate.drawerDidAnimation(drawerController:side:percentage:))) + .map { a in + return ( + side: try castOrThrow(DrawerSide.self, a[1]), + percent: try castOrThrow(Float.self, a[2]) + ) + } + + return ControlEvent(events: source) + } + public var didBeganAnimation: ControlEvent { + let source = delegate + .methodInvoked(#selector(DrawerControllerDelegate.drawerDidBeganAnimation(drawerController:side:))) + .map { try castOrThrow(DrawerSide.self, $0[1]) } + + return ControlEvent(events: source) + } + public var willFinishAnimation: ControlEvent { + let source = delegate + .methodInvoked(#selector(DrawerControllerDelegate.drawerWillFinishAnimation(drawerController:side:))) + .map { try castOrThrow(DrawerSide.self, $0[1]) } + + return ControlEvent(events: source) + } + public var willCancelAnimation: ControlEvent { + let source = delegate + .methodInvoked(#selector(DrawerControllerDelegate.drawerWillCancelAnimation(drawerController:side:))) + .map { try castOrThrow(DrawerSide.self, $0[1]) } + + return ControlEvent(events: source) + } + public var didFinishAnimation: ControlEvent { + let source = delegate + .methodInvoked(#selector(DrawerControllerDelegate.drawerDidFinishAnimation(drawerController:side:))) + .map { try castOrThrow(DrawerSide.self, $0[1]) } + + return ControlEvent(events: source) + } + public var didCancelAnimation: ControlEvent { + let source = delegate + .methodInvoked(#selector(DrawerControllerDelegate.drawerDidCancelAnimation(drawerController:side:))) + .map { try castOrThrow(DrawerSide.self, $0[1]) } + + return ControlEvent(events: source) + } + +} diff --git a/DrawerController/Rx/RxDrawerControllerDelegateProxy.swift b/DrawerController/Rx/RxDrawerControllerDelegateProxy.swift new file mode 100644 index 0000000..0b15fd3 --- /dev/null +++ b/DrawerController/Rx/RxDrawerControllerDelegateProxy.swift @@ -0,0 +1,47 @@ +/* + The MIT License (MIT) + + Copyright (c) 2017 Kawoou (Jungwon An) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +import RxCocoa +import RxSwift + +extension DrawerController: HasDelegate { + public typealias Delegate = DrawerControllerDelegate +} + +class RxDrawerControllerDelegateProxy: DelegateProxy, DelegateProxyType, DrawerControllerDelegate { + + /// Typed parent object. + public private(set) weak var drawerController: DrawerController? + + /// - parameter mapView: Parent object for delegate proxy. + public init(drawerController: DrawerController) { + self.drawerController = drawerController + super.init(parentObject: drawerController, delegateProxy: RxDrawerControllerDelegateProxy.self) + } + + static func registerKnownImplementations() { + self.register { RxDrawerControllerDelegateProxy(drawerController: $0) } + } + +} diff --git a/DrawerController/Types/DrawerSide.swift b/DrawerController/Types/DrawerSide.swift index db36b16..5339ed8 100644 --- a/DrawerController/Types/DrawerSide.swift +++ b/DrawerController/Types/DrawerSide.swift @@ -29,4 +29,15 @@ public enum DrawerSide: Int { case left = 0 case right case none + + var stringValue: String { + switch self { + case .left: + return "Left" + case .right: + return "Right" + case .none: + return "None" + } + } } diff --git a/Example/Conroller/MainViewController.swift b/Example/Conroller/MainViewController.swift index 470e46d..7f8b3ad 100644 --- a/Example/Conroller/MainViewController.swift +++ b/Example/Conroller/MainViewController.swift @@ -7,13 +7,51 @@ // import UIKit +import RxSwift class MainViewController: UITabBarController { + + let disposeBag = DisposeBag() override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. + drawerController?.rx.didAnimation + .subscribe(onNext: { (side, percent) in + print("DrawerController.rx.didAnimation: \(side.stringValue), \(percent)") + }) + .disposed(by: disposeBag) + + drawerController?.rx.didBeganAnimation + .subscribe(onNext: { (side) in + print("DrawerController.rx.didBeganAnimation: \(side.stringValue)") + }) + .disposed(by: disposeBag) + + drawerController?.rx.willFinishAnimation + .subscribe(onNext: { (side) in + print("DrawerController.rx.willFinishAnimation: \(side.stringValue)") + }) + .disposed(by: disposeBag) + + drawerController?.rx.willCancelAnimation + .subscribe(onNext: { (side) in + print("DrawerController.rx.willCancelAnimation: \(side.stringValue)") + }) + .disposed(by: disposeBag) + + drawerController?.rx.didFinishAnimation + .subscribe(onNext: { (side) in + print("DrawerController.rx.didFinishAnimation: \(side.stringValue)") + }) + .disposed(by: disposeBag) + + drawerController?.rx.didCancelAnimation + .subscribe(onNext: { (side) in + print("DrawerController.rx.didCancelAnimation: \(side.stringValue)") + }) + .disposed(by: disposeBag) + } override func didReceiveMemoryWarning() { @@ -24,16 +62,24 @@ class MainViewController: UITabBarController { @IBAction func leftButtonDidPressed(_ sender: UIBarButtonItem) { if self.drawerController!.drawerSide == .none { self.drawerController?.openSide(.left) + .subscribe() + .disposed(by: disposeBag) } else { self.drawerController?.closeSide() + .subscribe() + .disposed(by: disposeBag) } } @IBAction func rightButtonDidPressed(_ sender: UIBarButtonItem) { if self.drawerController!.drawerSide == .none { self.drawerController?.openSide(.right) + .subscribe() + .disposed(by: disposeBag) } else { self.drawerController?.closeSide() + .subscribe() + .disposed(by: disposeBag) } } diff --git a/Example/KWDrawerController-Example.xcodeproj/project.pbxproj b/Example/KWDrawerController-Example.xcodeproj/project.pbxproj index e13243a..ac7246f 100644 --- a/Example/KWDrawerController-Example.xcodeproj/project.pbxproj +++ b/Example/KWDrawerController-Example.xcodeproj/project.pbxproj @@ -52,9 +52,14 @@ 9D2D4CB11E4F729E00E2B7A7 /* DrawerSide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2D4C8F1E4F729D00E2B7A7 /* DrawerSide.swift */; }; 9D2D4CB21E4F729E00E2B7A7 /* UIViewController+DrawerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2D4C901E4F729E00E2B7A7 /* UIViewController+DrawerController.swift */; }; 9D2D4CB31E4F729E00E2B7A7 /* TranslucentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2D4C921E4F729E00E2B7A7 /* TranslucentView.swift */; }; + 9DDA895C2004E6C200F9FD86 /* RxDrawerControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DDA895B2004E6C200F9FD86 /* RxDrawerControllerDelegateProxy.swift */; }; + 9DDA895E2004E80E00F9FD86 /* DrawerController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DDA895D2004E80E00F9FD86 /* DrawerController+Rx.swift */; }; + C806E5AE0BEE7DBEAF865AC2 /* Pods_KWDrawerController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB7D4608B1429FE012C6BB40 /* Pods_KWDrawerController_Example.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1C925ED7E7E9258F55B31377 /* Pods-KWDrawerController-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KWDrawerController-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-KWDrawerController-Example/Pods-KWDrawerController-Example.debug.xcconfig"; sourceTree = ""; }; + 6B3DBE7050D31D5BF4626964 /* Pods-KWDrawerController-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KWDrawerController-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-KWDrawerController-Example/Pods-KWDrawerController-Example.release.xcconfig"; sourceTree = ""; }; 9D2D4C2A1E4F71CF00E2B7A7 /* KWDrawerController-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "KWDrawerController-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 9D2D4C3F1E4F722100E2B7A7 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = SOURCE_ROOT; }; 9D2D4C401E4F722100E2B7A7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; @@ -102,6 +107,9 @@ 9D2D4C8F1E4F729D00E2B7A7 /* DrawerSide.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DrawerSide.swift; sourceTree = ""; }; 9D2D4C901E4F729E00E2B7A7 /* UIViewController+DrawerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+DrawerController.swift"; sourceTree = ""; }; 9D2D4C921E4F729E00E2B7A7 /* TranslucentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TranslucentView.swift; sourceTree = ""; }; + 9DDA895B2004E6C200F9FD86 /* RxDrawerControllerDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxDrawerControllerDelegateProxy.swift; sourceTree = ""; }; + 9DDA895D2004E80E00F9FD86 /* DrawerController+Rx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DrawerController+Rx.swift"; sourceTree = ""; }; + EB7D4608B1429FE012C6BB40 /* Pods_KWDrawerController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KWDrawerController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -109,17 +117,29 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + C806E5AE0BEE7DBEAF865AC2 /* Pods_KWDrawerController_Example.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 9CAB31398E8FC1A0AFCC0F02 /* Pods */ = { + isa = PBXGroup; + children = ( + 1C925ED7E7E9258F55B31377 /* Pods-KWDrawerController-Example.debug.xcconfig */, + 6B3DBE7050D31D5BF4626964 /* Pods-KWDrawerController-Example.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; 9D2D4C211E4F71CF00E2B7A7 = { isa = PBXGroup; children = ( 9D2D4C2C1E4F71CF00E2B7A7 /* KWDrawerController-Example */, 9D2D4C2B1E4F71CF00E2B7A7 /* Products */, + 9CAB31398E8FC1A0AFCC0F02 /* Pods */, + C2FB08FA74310FEF2A6FCCC5 /* Frameworks */, ); sourceTree = ""; }; @@ -163,6 +183,7 @@ 9D2D4C6B1E4F729D00E2B7A7 /* DrawerController */ = { isa = PBXGroup; children = ( + 9DDA895A2004E6C200F9FD86 /* Rx */, 9D2D4C6C1E4F729D00E2B7A7 /* Animator */, 9D2D4C7D1E4F729D00E2B7A7 /* Models */, 9D2D4C801E4F729D00E2B7A7 /* Segue */, @@ -249,6 +270,23 @@ path = View; sourceTree = ""; }; + 9DDA895A2004E6C200F9FD86 /* Rx */ = { + isa = PBXGroup; + children = ( + 9DDA895D2004E80E00F9FD86 /* DrawerController+Rx.swift */, + 9DDA895B2004E6C200F9FD86 /* RxDrawerControllerDelegateProxy.swift */, + ); + path = Rx; + sourceTree = ""; + }; + C2FB08FA74310FEF2A6FCCC5 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EB7D4608B1429FE012C6BB40 /* Pods_KWDrawerController_Example.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -256,9 +294,12 @@ isa = PBXNativeTarget; buildConfigurationList = 9D2D4C3C1E4F71CF00E2B7A7 /* Build configuration list for PBXNativeTarget "KWDrawerController-Example" */; buildPhases = ( + 821A3A08B25DBA11FAA55FD6 /* [CP] Check Pods Manifest.lock */, 9D2D4C261E4F71CF00E2B7A7 /* Sources */, 9D2D4C271E4F71CF00E2B7A7 /* Frameworks */, 9D2D4C281E4F71CF00E2B7A7 /* Resources */, + D8C48F2C503487AD4185C3CA /* [CP] Embed Pods Frameworks */, + D74FDD6625759EE9DC0DECC8 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -317,6 +358,62 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 821A3A08B25DBA11FAA55FD6 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-KWDrawerController-Example-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + D74FDD6625759EE9DC0DECC8 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWDrawerController-Example/Pods-KWDrawerController-Example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + D8C48F2C503487AD4185C3CA /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-KWDrawerController-Example/Pods-KWDrawerController-Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWDrawerController-Example/Pods-KWDrawerController-Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 9D2D4C261E4F71CF00E2B7A7 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -324,6 +421,7 @@ files = ( 9D2D4C9C1E4F729E00E2B7A7 /* DrawerQuadEaseAnimator.swift in Sources */, 9D2D4C421E4F722100E2B7A7 /* AppDelegate.swift in Sources */, + 9DDA895E2004E80E00F9FD86 /* DrawerController+Rx.swift in Sources */, 9D2D4C9E1E4F729E00E2B7A7 /* DrawerQuintEaseAnimator.swift in Sources */, 9D2D4C691E4F728C00E2B7A7 /* RightViewController.swift in Sources */, 9D2D4C9A1E4F729E00E2B7A7 /* DrawerExpoEaseAnimator.swift in Sources */, @@ -345,6 +443,7 @@ 9D2D4C641E4F728C00E2B7A7 /* LeftOptionViewController.swift in Sources */, 9D2D4C9D1E4F729E00E2B7A7 /* DrawerQuartEaseAnimator.swift in Sources */, 9D2D4C681E4F728C00E2B7A7 /* RightOptionViewController.swift in Sources */, + 9DDA895C2004E6C200F9FD86 /* RxDrawerControllerDelegateProxy.swift in Sources */, 9D2D4CA21E4F729E00E2B7A7 /* DrawerController.swift in Sources */, 9D2D4CAB1E4F729E00E2B7A7 /* DrawerScaleTransition.swift in Sources */, 9D2D4CAD1E4F729E00E2B7A7 /* DrawerSwingTransition.swift in Sources */, @@ -467,6 +566,7 @@ }; 9D2D4C3D1E4F71CF00E2B7A7 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 1C925ED7E7E9258F55B31377 /* Pods-KWDrawerController-Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -482,6 +582,7 @@ }; 9D2D4C3E1E4F71CF00E2B7A7 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6B3DBE7050D31D5BF4626964 /* Pods-KWDrawerController-Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; diff --git a/Example/KWDrawerController-Example.xcworkspace/contents.xcworkspacedata b/Example/KWDrawerController-Example.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..12da4a5 --- /dev/null +++ b/Example/KWDrawerController-Example.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/Podfile b/Example/Podfile new file mode 100644 index 0000000..d16d724 --- /dev/null +++ b/Example/Podfile @@ -0,0 +1,11 @@ +# Uncomment the next line to define a global platform for your project +# platform :ios, '9.0' + +target 'KWDrawerController-Example' do + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + + # Pods for KWDrawerController-Example + pod 'RxSwift', '~> 4.0' + pod 'RxCocoa', '~> 4.0' +end diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..42f8570 --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,16 @@ +PODS: + - RxCocoa (4.1.0): + - RxSwift (~> 4.0) + - RxSwift (4.1.0) + +DEPENDENCIES: + - RxCocoa (~> 4.0) + - RxSwift (~> 4.0) + +SPEC CHECKSUMS: + RxCocoa: cc1fec49cdc8fabe645964de7c51c099a36c2aa8 + RxSwift: 4219941c1244c88002901bd87a69d3aea9ae71f0 + +PODFILE CHECKSUM: 9923445203e342381935f12488d92e88616970fb + +COCOAPODS: 1.3.1 diff --git a/KWDrawerController.podspec b/KWDrawerController.podspec index 5a22515..e01a7fd 100644 --- a/KWDrawerController.podspec +++ b/KWDrawerController.podspec @@ -10,17 +10,28 @@ Pod::Spec.new do |s| s.platform = :ios s.source = { :git => 'https://github.com/kawoou/KWDrawerController.git', :tag => 'v' + s.version.to_s } - s.source_files = 'DrawerController/Types/*.swift', - 'DrawerController/Models/*.swift', - 'DrawerController/View/*.swift', - 'DrawerController/Animator/*.swift', - 'DrawerController/Transition/*.swift', - 'DrawerController/*.swift', - 'DrawerController/Segue/*.swift' s.frameworks = 'QuartzCore' s.module_name = 'KWDrawerController' s.requires_arc = true s.ios.deployment_target = '8.0' + s.default_subspec = 'Core' + + s.subspec 'Core' do |ss| + ss.source_files = 'DrawerController/Types/*.swift', + 'DrawerController/Models/*.swift', + 'DrawerController/View/*.swift', + 'DrawerController/Animator/*.swift', + 'DrawerController/Transition/*.swift', + 'DrawerController/*.swift', + 'DrawerController/Segue/*.swift' + end + + s.subspec 'RxSwift' do |ss| + ss.source_files = 'DrawerController/Rx/*.swift' + ss.dependency "KWDrawerController/Core" + ss.dependency "RxSwift", ">= 4.0.0" + ss.dependency "RxCocoa", ">= 4.0.0" + end end From d6ff0ffaa6dc3a9a7f75c42f2594485a11dd3fe5 Mon Sep 17 00:00:00 2001 From: kawoou Date: Tue, 9 Jan 2018 21:54:51 +0900 Subject: [PATCH 2/2] Bump version. --- KWDrawerController.podspec | 2 +- README.md | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/KWDrawerController.podspec b/KWDrawerController.podspec index e01a7fd..5c1e964 100644 --- a/KWDrawerController.podspec +++ b/KWDrawerController.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'KWDrawerController' - s.version = '4.1' + s.version = '4.1.1' s.summary = 'Drawer view controller that easy to use!' s.license = { :type => 'MIT', :file => 'LICENSE' } s.homepage = 'https://github.com/kawoou/KWDrawerController' diff --git a/README.md b/README.md index 2e587ae..18791b7 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,12 @@ Installation KWDrawerController is available on [CocoaPods](https://github.com/cocoapods/cocoapods). Add the following to your Podfile: ```ruby -// Swift 3.x +# Swift 3 pod 'KWDrawerController', '~> 3.7' -// Swift 4 -pod 'KWDrawerController', '~> 4.1' +# Swift 4 +pod 'KWDrawerController', '~> 4.1.1' +pod 'KWDrawerController/RxSwift' # with RxSwift extension ``` @@ -237,6 +238,7 @@ Changelog + 3.7 Fixed not updating issues on properties. + 4.0 Support Swift 4. + 4.1 Implement new flag that enables direction auto-switching. ++ 4.1.1 Support RxSwift(If you want). ⚠️ Requirements --------------