From a7eda4f12ea1d5ee769479257cfb625076b64bb3 Mon Sep 17 00:00:00 2001 From: shoheiyokoyama Date: Mon, 9 Oct 2017 17:02:22 +0900 Subject: [PATCH] Supports swift4 --- Example/Gemini.xcodeproj/project.pbxproj | 16 +++++++++------ Example/Gemini/AppDelegate.swift | 2 +- .../CircleRotationViewController.swift | 2 +- .../ViewControllers/CubeViewController.swift | 2 +- .../CustomAnimationViewController.swift | 2 +- .../PitchRotationViewController.swift | 2 +- .../RollRotationViewController.swift | 2 +- .../ScaleAnimationViewController.swift | 2 +- .../YawRotationViewController.swift | 2 +- Example/Gemini/Views/PlayerView.swift | 4 ++-- Example/Pods/Pods.xcodeproj/project.pbxproj | 20 +++++++++++++++---- README.md | 2 +- 12 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Example/Gemini.xcodeproj/project.pbxproj b/Example/Gemini.xcodeproj/project.pbxproj index 4a0ac76..5763011 100644 --- a/Example/Gemini.xcodeproj/project.pbxproj +++ b/Example/Gemini.xcodeproj/project.pbxproj @@ -296,11 +296,11 @@ TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0820; + LastSwiftMigration = 0900; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0820; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; TestTargetID = 607FACCF1AFB9204008FA782; }; @@ -573,7 +573,8 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -588,7 +589,8 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -610,7 +612,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -628,7 +631,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Example/Gemini/AppDelegate.swift b/Example/Gemini/AppDelegate.swift index 9e621db..0088776 100644 --- a/Example/Gemini/AppDelegate.swift +++ b/Example/Gemini/AppDelegate.swift @@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { window?.makeKeyAndVisible() UINavigationBar.appearance().tintColor = .white - UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] + UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.white] UINavigationBar.appearance().setBackgroundImage(image(of: UIColor.black.withAlphaComponent(0.75)), for: .default) UINavigationBar.appearance().shadowImage = UIImage() diff --git a/Example/Gemini/ViewControllers/CircleRotationViewController.swift b/Example/Gemini/ViewControllers/CircleRotationViewController.swift index 46d8dc6..95c3820 100644 --- a/Example/Gemini/ViewControllers/CircleRotationViewController.swift +++ b/Example/Gemini/ViewControllers/CircleRotationViewController.swift @@ -57,7 +57,7 @@ final class CircleRotationViewController: UIViewController { view.addGestureRecognizer(gesture) } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/ViewControllers/CubeViewController.swift b/Example/Gemini/ViewControllers/CubeViewController.swift index 53004cd..30ac71b 100644 --- a/Example/Gemini/ViewControllers/CubeViewController.swift +++ b/Example/Gemini/ViewControllers/CubeViewController.swift @@ -52,7 +52,7 @@ final class CubeViewController: UIViewController { view.addGestureRecognizer(gesture) } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/ViewControllers/CustomAnimationViewController.swift b/Example/Gemini/ViewControllers/CustomAnimationViewController.swift index 80a728a..4b9cc28 100644 --- a/Example/Gemini/ViewControllers/CustomAnimationViewController.swift +++ b/Example/Gemini/ViewControllers/CustomAnimationViewController.swift @@ -95,7 +95,7 @@ final class CustomAnimationViewController: UIViewController { } } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/ViewControllers/PitchRotationViewController.swift b/Example/Gemini/ViewControllers/PitchRotationViewController.swift index 517bdb8..117fda5 100644 --- a/Example/Gemini/ViewControllers/PitchRotationViewController.swift +++ b/Example/Gemini/ViewControllers/PitchRotationViewController.swift @@ -68,7 +68,7 @@ final class PitchRotationViewController: UIViewController { view.layer.insertSublayer(gradientLayer, at: 0) } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/ViewControllers/RollRotationViewController.swift b/Example/Gemini/ViewControllers/RollRotationViewController.swift index 717196a..200adb5 100644 --- a/Example/Gemini/ViewControllers/RollRotationViewController.swift +++ b/Example/Gemini/ViewControllers/RollRotationViewController.swift @@ -72,7 +72,7 @@ final class RollRotationViewController: UIViewController { super.viewDidAppear(animated) } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/ViewControllers/ScaleAnimationViewController.swift b/Example/Gemini/ViewControllers/ScaleAnimationViewController.swift index a8fb4b2..f12fa74 100644 --- a/Example/Gemini/ViewControllers/ScaleAnimationViewController.swift +++ b/Example/Gemini/ViewControllers/ScaleAnimationViewController.swift @@ -59,7 +59,7 @@ final class ScaleAnimationViewController: UIViewController { collectionView.decelerationRate = UIScrollViewDecelerationRateFast } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/ViewControllers/YawRotationViewController.swift b/Example/Gemini/ViewControllers/YawRotationViewController.swift index f11adaf..9b54004 100644 --- a/Example/Gemini/ViewControllers/YawRotationViewController.swift +++ b/Example/Gemini/ViewControllers/YawRotationViewController.swift @@ -60,7 +60,7 @@ final class YawRotationViewController: UIViewController { collectionView.decelerationRate = UIScrollViewDecelerationRateFast } - func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { + @objc func toggleNavigationBarHidden(_ gestureRecognizer: UITapGestureRecognizer) { let isNavigationBarHidden = navigationController?.isNavigationBarHidden ?? true navigationController?.setNavigationBarHidden(!isNavigationBarHidden, animated: true) } diff --git a/Example/Gemini/Views/PlayerView.swift b/Example/Gemini/Views/PlayerView.swift index e7d6388..35ab634 100644 --- a/Example/Gemini/Views/PlayerView.swift +++ b/Example/Gemini/Views/PlayerView.swift @@ -24,12 +24,12 @@ final class PlayerView: UIView { override init(frame: CGRect) { super.init(frame: frame) - playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill + playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) - playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill + playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill } func setVideoURL(_ url: URL) { diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 2811602..31ec9ee 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -276,6 +276,14 @@ attributes = { LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0900; + TargetAttributes = { + 3B4BBB868E64E3B1D09E4EE452616D9B = { + LastSwiftMigration = 0900; + }; + FCD5AA9DE71943D0A20424568E1AAB6C = { + LastSwiftMigration = 0900; + }; + }; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -369,7 +377,8 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -403,7 +412,8 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -438,7 +448,8 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -585,7 +596,8 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/README.md b/README.md index 48c2e0f..8325bfa 100644 --- a/README.md +++ b/README.md @@ -316,7 +316,7 @@ To run the example project, clone the repo, and run `pod install` from the Examp ## Requirements - Xcode 9.0+ -- Swift 3.2 +- Swift 4.0 ## Installation