From 9dbe320650b278a070093634f4b078cf530aa8d8 Mon Sep 17 00:00:00 2001 From: Vu Tiet Date: Wed, 3 Apr 2019 10:56:51 +0800 Subject: [PATCH] support swift version 4.2 --- .../Classes/CardStackController.swift | 16 +++++++-------- .../project.pbxproj | 6 ++++-- Example/CardStackController/AppDelegate.swift | 2 +- Example/Pods/Pods.xcodeproj/project.pbxproj | 20 +++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CardStackController/Classes/CardStackController.swift b/CardStackController/Classes/CardStackController.swift index 1b66067..6219ec3 100644 --- a/CardStackController/Classes/CardStackController.swift +++ b/CardStackController/Classes/CardStackController.swift @@ -9,7 +9,7 @@ import UIKit public class CardStackController: UIViewController { - public typealias CompletionBlock = (Void) -> () + public typealias CompletionBlock = () -> () fileprivate struct CardStackControllerPalette { static let backgroundColor = UIColor.black.withAlphaComponent(0.4) @@ -208,7 +208,7 @@ public class CardStackController: UIViewController { anim.toValue = NSValue(caTransform3D: finalTransform) anim.duration = 0.4 anim.timingFunction = CAMediaTimingFunction(controlPoints: 0.1, 0.5, 0.5, 1) - anim.fillMode = kCAFillModeForwards + anim.fillMode = CAMediaTimingFillMode.forwards anim.isRemovedOnCompletion = false viewController.view.layer.add(anim, forKey: "transform") } @@ -233,10 +233,10 @@ public class CardStackController: UIViewController { fileprivate func addChild(viewController newController: UIViewController, containerView: UIView, fakeViewBackgroundColor: UIColor?) { viewControllers.append(newController) - addChildViewController(newController) + addChild(newController) containerView.addSubview(newController.view) addFakeBottomView(underneath: newController.view, with: fakeViewBackgroundColor) - newController.didMove(toParentViewController: self) + newController.didMove(toParent: self) } fileprivate func attach(view aView: UIView, toAnchorPoint anchorPoint: CGPoint) { @@ -366,7 +366,7 @@ public class CardStackController: UIViewController { anim.toValue = NSValue(caTransform3D: CATransform3DIdentity) anim.duration = duration anim.timingFunction = CAMediaTimingFunction(controlPoints: 0.1, 0.5, 0.5, 1) - anim.fillMode = kCAFillModeForwards + anim.fillMode = CAMediaTimingFillMode.forwards anim.isRemovedOnCompletion = false viewController.view.layer.add(anim, forKey: "transformBack") } @@ -422,10 +422,10 @@ public class CardStackController: UIViewController { guard let viewController = topViewController, let currentBehaviour = attachmentBehaviors.last, let viewControllerSuperview = viewController.view.superview else { return } - viewController.willMove(toParentViewController: nil) + viewController.willMove(toParent: nil) viewController.view.removeFromSuperview() viewControllerSuperview.removeFromSuperview() - viewController.removeFromParentViewController() + viewController.removeFromParent() viewControllers.removeLast() animator.removeBehavior(currentBehaviour) attachmentBehaviors.removeLast() @@ -439,7 +439,7 @@ public class CardStackController: UIViewController { animator.removeBehavior(dynamicItemBehavior) animator.removeBehavior(collisionBehavior) guard automaticallyDismiss else { return } - dismiss(animated: false) { finished in + dismiss(animated: false) { self.delegate?.didFinishDismissingCardController?() } } diff --git a/Example/CardStackController.xcodeproj/project.pbxproj b/Example/CardStackController.xcodeproj/project.pbxproj index 1ae90ff..2871fc8 100644 --- a/Example/CardStackController.xcodeproj/project.pbxproj +++ b/Example/CardStackController.xcodeproj/project.pbxproj @@ -454,6 +454,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -493,6 +494,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; }; name = Release; @@ -509,7 +511,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "com.jobandtalent.CardStackController-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -525,7 +527,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "com.jobandtalent.CardStackController-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/Example/CardStackController/AppDelegate.swift b/Example/CardStackController/AppDelegate.swift index e827be8..a81d04d 100644 --- a/Example/CardStackController/AppDelegate.swift +++ b/Example/CardStackController/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 184f45e..be12ebd 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -31,8 +31,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 062B6F6DE4032EA42F68588E5919CE35 /* CardStackController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CardStackController.framework; path = CardStackController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 095A6FA0D0B683D7B616C8D375BCACAC /* Pods_CardStackController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CardStackController_Example.framework; path = "Pods-CardStackController_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 062B6F6DE4032EA42F68588E5919CE35 /* CardStackController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CardStackController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 095A6FA0D0B683D7B616C8D375BCACAC /* Pods_CardStackController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CardStackController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 09BBB3E1D45B56A141C36F02929DFA09 /* Pods-CardStackController_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CardStackController_Tests-frameworks.sh"; sourceTree = ""; }; 0DF3169BB9D0C11B87AE6921DDE305B2 /* CardStackController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CardStackController.swift; sourceTree = ""; }; 12B97EE1F5B10A757B001796A8A68C7C /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -40,19 +40,19 @@ 27D5F8D129CEE68AFE4AFD25693F855E /* CardStackController.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CardStackController.xcconfig; sourceTree = ""; }; 2DD9735B9C276BC75E72B0E90993DB83 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2FBCB59D030B3D43C65AC4914F38A5CD /* Pods-CardStackController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CardStackController_Example.release.xcconfig"; sourceTree = ""; }; - 3A2F2049517F1EF975008437AD31B6F2 /* Pods_CardStackController_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CardStackController_Tests.framework; path = "Pods-CardStackController_Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3A2F2049517F1EF975008437AD31B6F2 /* Pods_CardStackController_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CardStackController_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3ABE5947676A045EA9F02194E948EFB9 /* Pods-CardStackController_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CardStackController_Example.debug.xcconfig"; sourceTree = ""; }; - 43E461BCB5DF896C11195ACFEA990E0C /* Pods-CardStackController_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CardStackController_Example.modulemap"; sourceTree = ""; }; + 43E461BCB5DF896C11195ACFEA990E0C /* Pods-CardStackController_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-CardStackController_Example.modulemap"; sourceTree = ""; }; 48F9128AF50ACFA9440FC79AE671EFC7 /* Helpers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = ""; }; 516EF61F648A633F4B89725CCD6FB254 /* CardStackController-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CardStackController-dummy.m"; sourceTree = ""; }; 710FD139213C49177ADCFA460771AEFD /* CardStackController-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CardStackController-prefix.pch"; sourceTree = ""; }; 7C67A867E7EBDE0CCD6EB69D245BF0A8 /* Pods-CardStackController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CardStackController_Tests.release.xcconfig"; sourceTree = ""; }; 7F063D22CEB7AEBA6AF85FDE3037AF1A /* Pods-CardStackController_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CardStackController_Example-frameworks.sh"; sourceTree = ""; }; - 8DAD97285E2C9976E304C88535072F71 /* Pods-CardStackController_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CardStackController_Tests.modulemap"; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 8DAD97285E2C9976E304C88535072F71 /* Pods-CardStackController_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-CardStackController_Tests.modulemap"; sourceTree = ""; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9F74BCD1A817749B6231930FEAE66369 /* Pods-CardStackController_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CardStackController_Example-umbrella.h"; sourceTree = ""; }; A03D79729A46EE21A8CFC19F7B8ABD54 /* Pods-CardStackController_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CardStackController_Tests-dummy.m"; sourceTree = ""; }; - AF4523D2EE6D6B2EA81343D8E1997555 /* CardStackController.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = CardStackController.modulemap; sourceTree = ""; }; + AF4523D2EE6D6B2EA81343D8E1997555 /* CardStackController.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = CardStackController.modulemap; sourceTree = ""; }; BA535E6A928D69E28DAD7919992F9ABD /* Pods-CardStackController_Tests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CardStackController_Tests-acknowledgements.plist"; sourceTree = ""; }; BC87ED294F9F0B309797814E925DD31B /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BEFA088D3F71D120F941607DFE653DD2 /* Pods-CardStackController_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CardStackController_Tests-acknowledgements.markdown"; sourceTree = ""; }; @@ -204,7 +204,6 @@ 0DF3169BB9D0C11B87AE6921DDE305B2 /* CardStackController.swift */, 48F9128AF50ACFA9440FC79AE671EFC7 /* Helpers.swift */, ); - name = Classes; path = Classes; sourceTree = ""; }; @@ -213,7 +212,6 @@ children = ( DE4E84B96B1B4ED04DF6450E58378E38 /* Classes */, ); - name = CardStackController; path = CardStackController; sourceTree = ""; }; @@ -436,7 +434,7 @@ PRODUCT_NAME = CardStackController; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -624,7 +622,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = "";