From d6593e94f23f505ff38c25b9322930c0e5c591e3 Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Fri, 11 Oct 2019 23:49:10 +0200 Subject: [PATCH] Swift 5.1 --- .../AnimationClass.swift | 14 +++++++------- .../JTAppleCalendar iOS Example/AppDelegate.swift | 2 +- .../ViewController.swift | 2 +- JTAppleCalendar.xcodeproj/project.pbxproj | 11 +++++++---- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Example/JTAppleCalendar iOS Example/AnimationClass.swift b/Example/JTAppleCalendar iOS Example/AnimationClass.swift index 0a2e9db4..6d3aeec7 100644 --- a/Example/JTAppleCalendar iOS Example/AnimationClass.swift +++ b/Example/JTAppleCalendar iOS Example/AnimationClass.swift @@ -81,7 +81,7 @@ extension UIView { let topRotationAnimation = CABasicAnimation(keyPath: "transform.rotation.x") - topRotationAnimation.fillMode = kCAFillModeForwards + topRotationAnimation.fillMode = CAMediaTimingFillMode.forwards topRotationAnimation.isRemovedOnCompletion = false switch (inDirection) { case .open: @@ -97,7 +97,7 @@ extension UIView { let bottomRotationAnimation = CABasicAnimation(keyPath: "transform.rotation.x") - bottomRotationAnimation.fillMode = kCAFillModeForwards; + bottomRotationAnimation.fillMode = CAMediaTimingFillMode.forwards; bottomRotationAnimation.isRemovedOnCompletion = false switch (inDirection) { case .open: @@ -111,25 +111,25 @@ extension UIView { bottomHalfView.layer.add(bottomRotationAnimation, forKey:nil) let bottomTranslationAnimation = CABasicAnimation(keyPath: "transform.translation.y") - bottomTranslationAnimation.fillMode = kCAFillModeForwards + bottomTranslationAnimation.fillMode = CAMediaTimingFillMode.forwards bottomTranslationAnimation.isRemovedOnCompletion = false switch (inDirection) { case .open: bottomTranslationAnimation.fromValue = topHalfView.frame.minY bottomTranslationAnimation.toValue = 2 * bottomHalfView.frame.size.height - bottomTranslationAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) + bottomTranslationAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut) break; case .closed: bottomTranslationAnimation.fromValue = 2 * bottomHalfView.frame.size.height bottomTranslationAnimation.toValue = topHalfView.frame.minY - bottomTranslationAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) + bottomTranslationAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn) } //TODO: figure out a more precise timing function bottomHalfView.layer.add(bottomTranslationAnimation, forKey:nil) let opacityAnimation = CABasicAnimation(keyPath: "opacity") - opacityAnimation.fillMode = kCAFillModeForwards + opacityAnimation.fillMode = CAMediaTimingFillMode.forwards opacityAnimation.isRemovedOnCompletion = false switch (inDirection) { case .open: @@ -189,7 +189,7 @@ class AnimationClass { withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.3, initialSpringVelocity: 0.1, - options: UIViewAnimationOptions.beginFromCurrentState, + options: UIView.AnimationOptions.beginFromCurrentState, animations: { view.transform = CGAffineTransform(scaleX: 1, y: 1) }, diff --git a/Example/JTAppleCalendar iOS Example/AppDelegate.swift b/Example/JTAppleCalendar iOS Example/AppDelegate.swift index 07f3951b..cfb5d0da 100644 --- a/Example/JTAppleCalendar iOS Example/AppDelegate.swift +++ b/Example/JTAppleCalendar iOS Example/AppDelegate.swift @@ -16,7 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: - [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } diff --git a/Example/JTAppleCalendar iOS Example/ViewController.swift b/Example/JTAppleCalendar iOS Example/ViewController.swift index bc4d3b54..91f414e2 100644 --- a/Example/JTAppleCalendar iOS Example/ViewController.swift +++ b/Example/JTAppleCalendar iOS Example/ViewController.swift @@ -205,7 +205,7 @@ class ViewController: UIViewController { // Registering header cells is optional calendarView.register(UINib(nibName: "PinkSectionHeaderView", bundle: Bundle.main), - forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "PinkSectionHeaderView") // calendarView.registerDecorationView(nib: UINib(nibName: "SectionDecorationView", bundle: Bundle.main)) diff --git a/JTAppleCalendar.xcodeproj/project.pbxproj b/JTAppleCalendar.xcodeproj/project.pbxproj index 247407e8..16f48387 100644 --- a/JTAppleCalendar.xcodeproj/project.pbxproj +++ b/JTAppleCalendar.xcodeproj/project.pbxproj @@ -651,6 +651,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -968,6 +969,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -999,6 +1001,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -1057,7 +1060,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1110,7 +1113,7 @@ PRODUCT_NAME = JTAppleCalendar; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1377,7 +1380,7 @@ SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1424,7 +1427,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release;