Skip to content

Commit

Permalink
Merge pull request #17 from cats-oss/support-xcode10
Browse files Browse the repository at this point in the history
Support Xcode10
  • Loading branch information
Fumito Nakazawa authored Sep 27, 2018
2 parents 50fa42d + 2ae99bb commit 3adaee7
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Demo/SicaDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.funzin.sica-demo-app";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -341,7 +341,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.funzin.sica-demo-app";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
7 changes: 6 additions & 1 deletion Demo/SicaDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
#if swift(>=4.2)
typealias LaunchOptionsKey = UIApplication.LaunchOptionsKey
#else
typealias LaunchOptionsKey = UIApplicationLaunchOptionsKey
#endif
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<p align="center">
<img src="http://img.shields.io/badge/platform-iOS | tvOS | macOS-blue.svg?style=flat" alt="Platform" />
<a href="https://developer.apple.com/swift">
<img src="http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat" alt="Language" />
<img src="http://img.shields.io/badge/Swift-4.1%20|%204.2-brightgreen.svg?style=flat" alt="Language">
</a>
<a href="https://github.com/Carthage/Carthage">
<img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage" />
Expand All @@ -33,10 +33,11 @@ Sica can execute various animations sequentially or parallelly.
- Transition

## Requirements
- Xcode 9.3
- Xcode 9.3 or greater
- iOS 9 or greater
- tvOS 10.0 or greater
- macOS 10.11 or greater
- Swift 4.2 (since 0.3.4)


## Installation
Expand All @@ -63,7 +64,7 @@ pod 'Sica'
Sica is available through `SwiftPM`, create ` Package.swift` and add `dependencies` value
```Package.swift
dependencies: [
.package(url: "https://github.com/cats-oss/Sica.git", from: "0.3.3")
.package(url: "https://github.com/cats-oss/Sica.git", from: "0.3.4")
]
```
See also: [GitHub - j-channings/swift-package-manager-ios: Example of how to use SPM v4 to manage iOS dependencies](https://github.com/j-channings/swift-package-manager-ios)
Expand Down
4 changes: 2 additions & 2 deletions Sica.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Sica"
s.version = "0.3.3"
s.version = "0.3.4"
s.summary = "Sica can execute various animations sequentially or parallely"
s.homepage = "https://github.com/cats-oss/Sica"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand All @@ -18,5 +18,5 @@ Pod::Spec.new do |s|
s.osx.deployment_target = "10.11"
s.source = { :git => "https://github.com/cats-oss/Sica.git", :tag => "#{s.version}" }
s.source_files = "Sica/**/*.{swift}"
s.swift_version = '4.1'
s.swift_version = '4.2'
end
32 changes: 20 additions & 12 deletions Sica.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
objects = {

/* Begin PBXBuildFile section */
313DA7AB215D2C3100842816 /* FillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 313DA7AA215D2C3100842816 /* FillMode.swift */; };
313DA7AC215D2DBC00842816 /* FillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 313DA7AA215D2C3100842816 /* FillMode.swift */; };
313DA7AD215D2DBD00842816 /* FillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 313DA7AA215D2C3100842816 /* FillMode.swift */; };
9D436C3220E9E4DD00A1B938 /* TimingFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C620AC2BDD003232F6 /* TimingFunction.swift */; };
9D436C3320E9E4DD00A1B938 /* Transition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C220AC2BDD003232F6 /* Transition.swift */; };
9D436C3420E9E4DD00A1B938 /* CAAnimation+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C120AC2BDD003232F6 /* CAAnimation+Extension.swift */; };
Expand Down Expand Up @@ -64,6 +67,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
313DA7AA215D2C3100842816 /* FillMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillMode.swift; sourceTree = "<group>"; };
9D436C3F20E9E4DD00A1B938 /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D436C4120E9E62700A1B938 /* Info-macOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-macOS.plist"; sourceTree = "<group>"; };
9D436C5120E9E71900A1B938 /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -196,6 +200,7 @@
D4CB78C420AC2BDD003232F6 /* Animator.swift */,
D4CB78C120AC2BDD003232F6 /* CAAnimation+Extension.swift */,
D449535220EE1F20004C8AB9 /* CALayer+Sica.swift */,
313DA7AA215D2C3100842816 /* FillMode.swift */,
D4CB78C620AC2BDD003232F6 /* TimingFunction.swift */,
D4CB78C220AC2BDD003232F6 /* Transition.swift */,
D449535020EE1BAF004C8AB9 /* View+Sica.swift */,
Expand Down Expand Up @@ -482,6 +487,7 @@
9D436C3420E9E4DD00A1B938 /* CAAnimation+Extension.swift in Sources */,
9D436C3520E9E4DD00A1B938 /* Animator.swift in Sources */,
9D68159820EF10BF007B3FB0 /* View+Sica.swift in Sources */,
313DA7AC215D2DBC00842816 /* FillMode.swift in Sources */,
9D436C3620E9E4DD00A1B938 /* AnimationKeyPaths.swift in Sources */,
9D68159620EF10BB007B3FB0 /* CALayer+Sica.swift in Sources */,
);
Expand All @@ -496,6 +502,7 @@
9D436C4620E9E71900A1B938 /* CAAnimation+Extension.swift in Sources */,
9D436C4720E9E71900A1B938 /* Animator.swift in Sources */,
9D68159920EF10BF007B3FB0 /* View+Sica.swift in Sources */,
313DA7AD215D2DBD00842816 /* FillMode.swift in Sources */,
9D436C4820E9E71900A1B938 /* AnimationKeyPaths.swift in Sources */,
9D68159720EF10BC007B3FB0 /* CALayer+Sica.swift in Sources */,
);
Expand Down Expand Up @@ -526,6 +533,7 @@
D4CB78CA20AC2BDD003232F6 /* CAAnimation+Extension.swift in Sources */,
D4CB78CD20AC2BDD003232F6 /* Animator.swift in Sources */,
D449535320EE1F20004C8AB9 /* CALayer+Sica.swift in Sources */,
313DA7AB215D2C3100842816 /* FillMode.swift in Sources */,
D449535120EE1BAF004C8AB9 /* View+Sica.swift in Sources */,
D4CB78CE20AC2BDD003232F6 /* AnimationKeyPaths.swift in Sources */,
);
Expand Down Expand Up @@ -584,7 +592,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -613,7 +621,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -641,7 +649,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand Down Expand Up @@ -670,7 +678,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand All @@ -693,7 +701,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
Expand All @@ -715,7 +723,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
};
name = Release;
Expand All @@ -737,7 +745,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -759,7 +767,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -906,7 +914,7 @@
PRODUCT_NAME = Sica;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -933,7 +941,7 @@
PRODUCT_NAME = Sica;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -954,7 +962,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.cats-oss.SicaTests";
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -975,7 +983,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.cats-oss.SicaTests";
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion Sica/Source/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public final class Animator {
}
group.animations = animations
group.duration = totalDuration(type: type)
group.fillMode = kCAFillModeForwards
group.fillMode = FillMode.forwards.rawValue
group.isRemovedOnCompletion = isRemovedOnCompletion

if let completion = completion {
Expand Down
2 changes: 1 addition & 1 deletion Sica/Source/CAAnimation+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension CAAnimation {
self.beginTime = delay
self.duration = duration
self.timingFunction = timingFunction.rawValue
self.fillMode = kCAFillModeForwards
self.fillMode = FillMode.forwards.rawValue
self.isRemovedOnCompletion = isRemovedOnCompletion
}
}
27 changes: 27 additions & 0 deletions Sica/Source/FillMode.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// FillMode.swift
// Sica-iOS
//
// Created by 中澤郁斗 on 2018/09/28.
// Copyright © 2018年 中澤 郁斗. All rights reserved.
//

import Foundation

public struct FillMode {
#if swift(>=4.2)
typealias RawValue = CAMediaTimingFillMode
public static let forwards = FillMode(rawValue: .forwards)
public static let backwards = FillMode(rawValue: .backwards)
public static let both = FillMode(rawValue: .both)
public static let removed = FillMode(rawValue: .removed)
#else
typealias RawValue = String
public static let forwards = FillMode(rawValue: kCAFillModeForwards)
public static let backwards = FillMode(rawValue: kCAFillModeBackwards)
public static let both = FillMode(rawValue: kCAFillModeBoth)
public static let removed = FillMode(rawValue: kCAFillModeRemoved)
#endif

let rawValue: RawValue
}
46 changes: 42 additions & 4 deletions Sica/Source/TimingFunction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,70 @@
import QuartzCore

public struct TimingFunction {
#if swift(>=4.2)
public typealias NameValue = CAMediaTimingFunctionName
public static let `default` = TimingFunction(name: CAMediaTimingFunctionName.default)
public static let linear = TimingFunction(name: CAMediaTimingFunctionName.linear)
public static let easeIn = TimingFunction(name: CAMediaTimingFunctionName.easeIn)
public static let easeOut = TimingFunction(name: CAMediaTimingFunctionName.easeOut)
public static let easeInEaseOut = TimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
#else
public typealias NameValue = String
public static let `default` = TimingFunction(name: kCAMediaTimingFunctionDefault)
public static let linear = TimingFunction(name: kCAMediaTimingFunctionLinear)
public static let easeIn = TimingFunction(name: kCAMediaTimingFunctionEaseIn)
public static let easeOut = TimingFunction(name: kCAMediaTimingFunctionEaseOut)
public static let easeInEaseOut = TimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
#endif

public let name: String

public let name: NameValue
public let rawValue: CAMediaTimingFunction

init(name: String) {
init(name: NameValue) {
self.name = name
self.rawValue = CAMediaTimingFunction(name: name)
}

init(name: String, rawValue: CAMediaTimingFunction) {
init(name: NameValue, rawValue: CAMediaTimingFunction) {
self.name = name
self.rawValue = rawValue
}

public init(name: String, controlPoints c1x: Float, _ c1y: Float, _ c2x: Float, _ c2y: Float) {
public init(name: NameValue, controlPoints c1x: Float, _ c1y: Float, _ c2x: Float, _ c2y: Float) {
self.name = name
self.rawValue = CAMediaTimingFunction(controlPoints: c1x, c1y, c2x, c2y)
}
}

// - SeeAlso: https://github.com/ai/easings.net/
extension TimingFunction {
#if swift(>=4.2)
public static let easeInSine = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInSine"), controlPoints: 0.47, 0, 0.745, 0.715)
public static let easeOutSine = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutSine"), controlPoints: 0.39, 0.575, 0.565, 1)
public static let easeInOutSine = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutSine"), controlPoints: 0.445, 0.05, 0.55, 0.95)
public static let easeInQuad = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInQuad"), controlPoints: 0.55, 0.085, 0.68, 0.53)
public static let easeOutQuad = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutQuad"), controlPoints: 0.25, 0.46, 0.45, 0.94)
public static let easeInOutQuad = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutQuad"), controlPoints: 0.455, 0.03, 0.515, 0.955)
public static let easeInCubic = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInCubic"), controlPoints: 0.55, 0.055, 0.675, 0.19)
public static let easeOutCubic = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutCubic"), controlPoints: 0.215, 0.61, 0.355, 1)
public static let easeInOutCubic = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutCubic"), controlPoints: 0.645, 0.045, 0.355, 1)
public static let easeInQuart = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInQuart"), controlPoints: 0.895, 0.03, 0.685, 0.22)
public static let easeOutQuart = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutQuart"), controlPoints: 0.165, 0.84, 0.44, 1)
public static let easeInOutQuart = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutQuart"), controlPoints: 0.77, 0, 0.175, 1)
public static let easeInQuint = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInQuint"), controlPoints: 0.755, 0.05, 0.855, 0.06)
public static let easeOutQuint = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutQuint"), controlPoints: 0.23, 1, 0.32, 1)
public static let easeInOutQuint = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutQuint"), controlPoints: 0.86, 0, 0.07, 1)
public static let easeInExpo = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInExpo"), controlPoints: 0.95, 0.05, 0.795, 0.035)
public static let easeOutExpo = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutExpo"), controlPoints: 0.19, 1, 0.22, 1)
public static let easeInOutExpo = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutExpo"), controlPoints: 1, 0, 0, 1)
public static let easeInCirc = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInCirc"), controlPoints: 0.6, 0.04, 0.98, 0.335)
public static let easeOutCirc = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutCirc"), controlPoints: 0.075, 0.82, 0.165, 1)
public static let easeInOutCirc = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutCirc"), controlPoints: 0.785, 0.135, 0.15, 0.86)
public static let easeInBack = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInBack"), controlPoints: 0.6, -0.28, 0.735, 0.045)
public static let easeOutBack = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutBack"), controlPoints: 0.175, 0.885, 0.32, 1.275)
public static let easeInOutBack = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutBack"), controlPoints: 0.68, -0.55, 0.265, 1.55)
#else
public static let easeInSine = TimingFunction(name: "easeInSine", controlPoints: 0.47, 0, 0.745, 0.715)
public static let easeOutSine = TimingFunction(name: "easeOutSine", controlPoints: 0.39, 0.575, 0.565, 1)
public static let easeInOutSine = TimingFunction(name: "easeInOutSine", controlPoints: 0.445, 0.05, 0.55, 0.95)
Expand All @@ -60,4 +97,5 @@ extension TimingFunction {
public static let easeInBack = TimingFunction(name: "easeInBack", controlPoints: 0.6, -0.28, 0.735, 0.045)
public static let easeOutBack = TimingFunction(name: "easeOutBack", controlPoints: 0.175, 0.885, 0.32, 1.275)
public static let easeInOutBack = TimingFunction(name: "easeInOutBack", controlPoints: 0.68, -0.55, 0.265, 1.55)
#endif
}
Loading

0 comments on commit 3adaee7

Please sign in to comment.