Skip to content

Commit

Permalink
Swift 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzBusch committed Oct 11, 2019
1 parent 50e237b commit d6593e9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
14 changes: 7 additions & 7 deletions Example/JTAppleCalendar iOS Example/AnimationClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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)
},
Expand Down
2 changes: 1 addition & 1 deletion Example/JTAppleCalendar iOS Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion Example/JTAppleCalendar iOS Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 7 additions & 4 deletions JTAppleCalendar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d6593e9

Please sign in to comment.