diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d5e198..e3836f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +#### 2.0.0 +- Support for Swift 5.0 +- Updated syntax in MotionOptions for newer Swift naming conventions +- Updated Swift package file to newest version, requires Xcode 11 to import +- Bumped version to 2.0.0 due to breaking change in MotionOptions (Swift Package Manager requires packages use semantic versioning) + #### 1.3.3 - Support for Swift 4.2 diff --git a/MotionMachine.podspec b/MotionMachine.podspec index 5f5e99b..092a799 100644 --- a/MotionMachine.podspec +++ b/MotionMachine.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'MotionMachine' - s.version = '1.3.3' - s.swift_version = '4.2' + s.version = '2.0.0' + s.swift_version = '5.0' s.license = { :type => 'MIT' } s.summary = 'An elegant, powerful, and modular animation library for Swift.' s.description = <<-DESC diff --git a/Package.swift b/Package.swift index 76eb7f3..30d61f6 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.0 // Package.swift // MotionMachine @@ -29,5 +29,19 @@ import PackageDescription let package = Package( name: "MotionMachine", - swiftLanguageVersions: [4.2] -) \ No newline at end of file + platforms: [ + .iOS(.v8), .tvOS(.v9) + ], + products: [ + .library(name: "MotionMachine", targets: ["MotionMachine"]) + ], + targets: [ + .target(name: "MotionMachine", path: "Sources/"), + .testTarget( + name: "MotionMachineTests", + dependencies: ["MotionMachine"], + path: "Tests/Tests/" + ) + ], + swiftLanguageVersions: [.v5] +) diff --git a/README.md b/README.md index c333027..dfdf61d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![MotionMachine logo](Guides/mmlogo.png) -![swift](https://img.shields.io/badge/Swift-4.2-005AA5.svg) +![swift](https://img.shields.io/badge/Swift-5.0-005AA5.svg) ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20tvOS-005AA5.svg) ![license](https://img.shields.io/badge/license-MIT-005AA5.svg) @@ -170,7 +170,7 @@ Or add the Sources directory to your project. ## Compatibility MotionMachine currently requires: -* Swift 4.2 +* Swift 5.0 * Xcode 10.0 or later * iOS 8.0 or later, tvOS 9.0 or later diff --git a/Sources/Motion.swift b/Sources/Motion.swift index 646dd78..66ddde9 100644 --- a/Sources/Motion.swift +++ b/Sources/Motion.swift @@ -522,7 +522,7 @@ public class Motion: Moveable, Additive, TempoDriven, PropertyDataDelegate { * - easing: An optional `EasingUpdateClosure` easing equation to use when moving the values of the given properties. `EasingLinear.easeNone()` is the default equation if none is provided. * - options: An optional set of `MotionsOptions`. */ - public convenience init(target targetObject: NSObject, properties: [PropertyData], duration: TimeInterval, easing: EasingUpdateClosure?=EasingLinear.easeNone(), options: MotionOptions?=MotionOptions.None) { + public convenience init(target targetObject: NSObject, properties: [PropertyData], duration: TimeInterval, easing: EasingUpdateClosure?=EasingLinear.easeNone(), options: MotionOptions? = .none) { self.init(target: targetObject, properties: properties, statesForProperties: nil, duration: duration, easing: easing, options: options) @@ -537,7 +537,7 @@ public class Motion: Moveable, Additive, TempoDriven, PropertyDataDelegate { * - easing: An optional `EasingUpdateClosure` easing equation to use when moving the values of the given properties. `EasingLinear.easeNone()` is the default equation if none is provided. * - options: An optional set of `MotionsOptions`. */ - public convenience init(target targetObject: NSObject, duration: TimeInterval, easing: EasingUpdateClosure?=EasingLinear.easeNone(), options: MotionOptions?=MotionOptions.None) { + public convenience init(target targetObject: NSObject, duration: TimeInterval, easing: EasingUpdateClosure?=EasingLinear.easeNone(), options: MotionOptions? = .none) { self.init(target: targetObject, properties: [], statesForProperties: nil, duration: duration, easing: easing, options: options) } @@ -552,13 +552,13 @@ public class Motion: Moveable, Additive, TempoDriven, PropertyDataDelegate { * - easing: An optional `EasingUpdateClosure` easing equation to use when moving the values of the given properties. `EasingLinear.easeNone()` is the default equation if none is provided. * - options: An optional set of `MotionsOptions`. */ - public convenience init(target targetObject: NSObject, statesForProperties templateObjects: [PropertyStates], duration: TimeInterval, easing: EasingUpdateClosure?=EasingLinear.easeNone(), options: MotionOptions?=MotionOptions.None) { + public convenience init(target targetObject: NSObject, statesForProperties templateObjects: [PropertyStates], duration: TimeInterval, easing: EasingUpdateClosure?=EasingLinear.easeNone(), options: MotionOptions? = .none) { self.init(target: targetObject, properties: nil, statesForProperties: templateObjects, duration: duration, easing: easing, options: options) } - private init(target targetObject: NSObject, properties props: [PropertyData]?, statesForProperties: [PropertyStates]?, duration: TimeInterval, easing: EasingUpdateClosure?, options: MotionOptions?) { + private init(target targetObject: NSObject, properties props: [PropertyData]?, statesForProperties: [PropertyStates]?, duration: TimeInterval, easing: EasingUpdateClosure?, options: MotionOptions? = .none) { var properties = props ?? [] @@ -578,9 +578,11 @@ public class Motion: Moveable, Additive, TempoDriven, PropertyDataDelegate { #endif // unpack options values - repeating = options!.contains(.Repeat) - reversing = options!.contains(.Reverse) - resetObjectStateOnRepeat = options!.contains(.ResetStateOnRepeat) + if let unwrappedOptions = options { + repeating = unwrappedOptions.contains(.repeats) + reversing = unwrappedOptions.contains(.reverses) + resetObjectStateOnRepeat = unwrappedOptions.contains(.resetsStateOnRepeat) + } motionState = .stopped motionDirection = .forward diff --git a/Sources/MotionGroup.swift b/Sources/MotionGroup.swift index 0d17c28..f33cb68 100644 --- a/Sources/MotionGroup.swift +++ b/Sources/MotionGroup.swift @@ -468,11 +468,13 @@ public class MotionGroup: Moveable, MoveableCollection, TempoDriven, MotionUpdat * - motions: An array of `Moveable` objects which the MotionGroup should control. * - options: An optional set of `MotionsOptions`. */ - public init(motions: [Moveable]=[], options: MotionOptions?=MotionOptions.None) { + public init(motions: [Moveable] = [], options: MotionOptions? = .none) { // unpack options values - repeating = options!.contains(.Repeat) - _reversing = options!.contains(.Reverse) + if let unwrappedOptions = options { + repeating = unwrappedOptions.contains(.repeats) + _reversing = unwrappedOptions.contains(.reverses) + } motionState = .stopped motionDirection = .forward @@ -555,7 +557,7 @@ public class MotionGroup: Moveable, MoveableCollection, TempoDriven, MotionUpdat public func remove(_ motion: Moveable) { // first grab the index of the object in the motions array so we can remove the corresponding tempoOverrides value - let index = motions.index { + let index = motions.firstIndex { $0 == motion } if let motion_index = index { diff --git a/Sources/MotionMachine.swift b/Sources/MotionMachine.swift index 865ab30..5d58019 100644 --- a/Sources/MotionMachine.swift +++ b/Sources/MotionMachine.swift @@ -335,7 +335,7 @@ public protocol ValueAssistant { public extension ValueAssistant { - public func retrieveCurrentObjectValue(forProperty property: PropertyData) -> Double? { + func retrieveCurrentObjectValue(forProperty property: PropertyData) -> Double? { guard let unwrapped_object = property.targetObject else { return nil } @@ -355,7 +355,7 @@ public extension ValueAssistant { // utility methods for ValueAssistant public extension ValueAssistant { - public func applyTo(value: inout Double, newValue: Double) { + func applyTo(value: inout Double, newValue: Double) { if (additive) { value += (newValue * additiveWeighting) } else { @@ -364,7 +364,7 @@ public extension ValueAssistant { } - public func applyTo(value: inout CGFloat, newValue: CGFloat) { + func applyTo(value: inout CGFloat, newValue: CGFloat) { if (additive) { value += (newValue * CGFloat(additiveWeighting)) } else { @@ -372,7 +372,7 @@ public extension ValueAssistant { } } - public func lastComponent(forPath path: String) -> String { + func lastComponent(forPath path: String) -> String { let components = path.components(separatedBy: ".") return components.last! } @@ -505,20 +505,20 @@ public struct MotionOptions : OptionSet { public init(rawValue: Int) { self.rawValue = rawValue } /// No options are specified. - public static let None = MotionOptions(rawValue: 0) + public static let none = MotionOptions(rawValue: 0) /// Specifies that a motion should repeat. - public static let Repeat = MotionOptions(rawValue: 1 << 0) + public static let repeats = MotionOptions(rawValue: 1 << 0) /// Specifies that a motion should reverse directions after moving in the forward direction. - public static let Reverse = MotionOptions(rawValue: 1 << 1) + public static let reverses = MotionOptions(rawValue: 1 << 1) /** * Specifies that a motion's property (or parent, if property is not KVC-compliant) should be reset to its starting value on repeats or restarts. * * - remark: `Motion` and `PhysicsMotion` are the only MotionMachine classes that currently accept this option. */ - public static let ResetStateOnRepeat = MotionOptions(rawValue: 1 << 2) + public static let resetsStateOnRepeat = MotionOptions(rawValue: 1 << 2) } diff --git a/Sources/MotionSequence.swift b/Sources/MotionSequence.swift index 1bb821e..b357ef7 100644 --- a/Sources/MotionSequence.swift +++ b/Sources/MotionSequence.swift @@ -485,11 +485,13 @@ public class MotionSequence: Moveable, MoveableCollection, TempoDriven, MotionUp * - steps: An array of `Moveable` objects the MotionSequence should control. The positions of the objects in the Array will determine the order in which the child motions should move. * - options: An optional set of `MotionsOptions`. */ - public init(steps: [Moveable]=[], options: MotionOptions?=MotionOptions.None) { + public init(steps: [Moveable] = [], options: MotionOptions? = .none) { // unpack options values - repeating = options!.contains(.Repeat) - _reversing = options!.contains(.Reverse) + if let unwrappedOptions = options { + repeating = unwrappedOptions.contains(.repeats) + _reversing = unwrappedOptions.contains(.reverses) + } motionState = .stopped motionDirection = .forward @@ -574,7 +576,7 @@ public class MotionSequence: Moveable, MoveableCollection, TempoDriven, MotionUp public func remove(_ sequenceStep: Moveable) { // first grab the index of the object in the motions array so we can remove the corresponding tempoOverrides value - let index = steps.index { + let index = steps.firstIndex { $0 == sequenceStep } diff --git a/Sources/PhysicsMotion.swift b/Sources/PhysicsMotion.swift index 2bfde5e..b8d8384 100644 --- a/Sources/PhysicsMotion.swift +++ b/Sources/PhysicsMotion.swift @@ -547,7 +547,7 @@ public class PhysicsMotion: Moveable, Additive, TempoDriven, PropertyDataDelegat * - friction: The friction used to calculate new values in the `PhysicsSolving` system. Acceptable values are 0.0 (no friction) to 1.0 (no movement); values outside of this range will be clamped to the nearest edge. * - options: An optional set of `MotionsOptions`. */ - public convenience init(target targetObject: NSObject, properties: [PropertyData], velocity: Double, friction: Double, options: MotionOptions?=MotionOptions.None) { + public convenience init(target targetObject: NSObject, properties: [PropertyData], velocity: Double, friction: Double, options: MotionOptions? = .none) { self.init(targetObject: targetObject, properties: properties, velocity: velocity, friction: friction, options: options) @@ -562,13 +562,13 @@ public class PhysicsMotion: Moveable, Additive, TempoDriven, PropertyDataDelegat * - friction: The friction used to calculate new values in the `PhysicsSolving` system. Acceptable values are 0.0 (no friction) to 1.0 (no movement); values outside of this range will be clamped to the nearest edge. * - options: An optional set of `MotionsOptions`. */ - public convenience init(target targetObject: NSObject, velocity: Double, friction: Double, options: MotionOptions?=MotionOptions.None) { + public convenience init(target targetObject: NSObject, velocity: Double, friction: Double, options: MotionOptions? = .none) { self.init(targetObject: targetObject, properties: [], velocity: velocity, friction: friction, options: options) } - private init(targetObject: NSObject, properties props: [PropertyData]?, velocity: Double, friction: Double, options: MotionOptions?) { + private init(targetObject: NSObject, properties props: [PropertyData]?, velocity: Double, friction: Double, options: MotionOptions? = .none) { let properties = props ?? [] @@ -583,9 +583,11 @@ public class PhysicsMotion: Moveable, Additive, TempoDriven, PropertyDataDelegat #endif // unpack options values - repeating = options!.contains(.Repeat) - reversing = options!.contains(.Reverse) - resetObjectStateOnRepeat = options!.contains(.ResetStateOnRepeat) + if let unwrappedOptions = options { + repeating = unwrappedOptions.contains(.repeats) + reversing = unwrappedOptions.contains(.reverses) + resetObjectStateOnRepeat = unwrappedOptions.contains(.resetsStateOnRepeat) + } motionState = .stopped motionDirection = .forward diff --git a/Tests/MotionMachine/AppDelegate.swift b/Tests/MotionMachine/AppDelegate.swift index 64c57cf..8c7f738 100644 --- a/Tests/MotionMachine/AppDelegate.swift +++ b/Tests/MotionMachine/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { return true } diff --git a/Tests/MotionMachineTests.xcodeproj/project.pbxproj b/Tests/MotionMachineTests.xcodeproj/project.pbxproj index b596f9a..c5b0c5d 100644 --- a/Tests/MotionMachineTests.xcodeproj/project.pbxproj +++ b/Tests/MotionMachineTests.xcodeproj/project.pbxproj @@ -297,25 +297,26 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Poet & Mountain, LLC"; TargetAttributes = { 8B62C0241CEF9C0F0087727A = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0920; + DevelopmentTeam = HJVTQESL5X; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; TestTargetID = 8B62C0B81CF014210087727A; }; 8B62C0B81CF014210087727A = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0920; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; }; }; buildConfigurationList = 8B62C00C1CEF9C0F0087727A /* Build configuration list for PBXProject "MotionMachineTests" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -442,6 +443,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -499,6 +501,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -551,13 +554,13 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; + DEVELOPMENT_TEAM = HJVTQESL5X; INFOPLIST_FILE = MotionMachineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.poetmountain.MotionMachineTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MotionMachine.app/MotionMachine"; }; name = Debug; @@ -571,8 +574,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.poetmountain.MotionMachineTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MotionMachine.app/MotionMachine"; }; name = Release; @@ -585,8 +587,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.poetmountain.MotionMachine; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -598,8 +599,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.poetmountain.MotionMachine; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Tests/Tests/MotionGroupTests.swift b/Tests/Tests/MotionGroupTests.swift index da32f5c..490c203 100644 --- a/Tests/Tests/MotionGroupTests.swift +++ b/Tests/Tests/MotionGroupTests.swift @@ -165,7 +165,7 @@ class MotionGroupTests: XCTestCase { let did_repeat = expectation(description: "group called cycleRepeated notify closure") let did_complete = expectation(description: "group called completed notify closure") - let group = MotionGroup(motions: [motion, motion2], options: [.Repeat]) + let group = MotionGroup(motions: [motion, motion2], options: [.repeats]) .cycleRepeated({ (group) in XCTAssertEqual(group.totalProgress, 0.5) XCTAssertEqual(group.cycleProgress, 0.0) @@ -206,7 +206,7 @@ class MotionGroupTests: XCTestCase { let did_reverse = expectation(description: "group called reversed notify closure") let did_complete = expectation(description: "group called completed notify closure") - let group = MotionGroup(motions: [motion, motion2], options: [.Reverse]) + let group = MotionGroup(motions: [motion, motion2], options: [.reverses]) .reversed({ (group) in XCTAssertTrue(group.totalProgress <= 0.5) XCTAssertTrue(group.cycleProgress <= 0.5) diff --git a/Tests/Tests/MotionSequenceTests.swift b/Tests/Tests/MotionSequenceTests.swift index 843d99c..c9fd226 100644 --- a/Tests/Tests/MotionSequenceTests.swift +++ b/Tests/Tests/MotionSequenceTests.swift @@ -173,7 +173,7 @@ class MotionSequenceTests: XCTestCase { let motion3 = Motion(target: tester, properties: [PropertyData("value", 40.0)], duration: 0.2) let motion4 = Motion(target: tester, properties: [PropertyData("value", 60.0)], duration: 0.2) - let sequence = MotionSequence(steps: [group, motion3, motion4], options: [.Repeat]) + let sequence = MotionSequence(steps: [group, motion3, motion4], options: [.repeats]) .cycleRepeated { (sequence) in let motion = sequence.steps.first as! MotionGroup XCTAssertTrue(sequence.currentStep() === motion) @@ -214,7 +214,7 @@ class MotionSequenceTests: XCTestCase { let motion3 = Motion(target: tester, properties: [PropertyData("value", 40.0)], duration: 0.2) let motion4 = Motion(target: tester, properties: [PropertyData("value", 60.0)], duration: 0.2) - let sequence = MotionSequence(steps: [group, motion3, motion4], options: [.Reverse]) + let sequence = MotionSequence(steps: [group, motion3, motion4], options: [.reverses]) .reversed({ (sequence) in let motion = sequence.steps.last as! Motion @@ -279,7 +279,7 @@ class MotionSequenceTests: XCTestCase { let motion5 = Motion(target: tester, properties: [PropertyData("value", 80.0)], duration: 0.2) let sub_sequence = MotionSequence(steps: [motion3, motion4]) - let sequence = MotionSequence(steps: [group, sub_sequence, motion5], options: [.Reverse]) + let sequence = MotionSequence(steps: [group, sub_sequence, motion5], options: [.reverses]) .reversed({ (sequence) in let motion = sequence.steps.last as! Motion let subsequence = sequence.steps[1] as! MotionSequence @@ -350,7 +350,7 @@ class MotionSequenceTests: XCTestCase { let motion4 = Motion(target: tester, properties: [PropertyData("value", 60.0)], duration: 0.2) let sub_sequence = MotionSequence(steps: [motion3, motion4]) - let sequence = MotionSequence(steps: [group, sub_sequence], options: [.Reverse]) + let sequence = MotionSequence(steps: [group, sub_sequence], options: [.reverses]) .reversed({ (sequence) in let motion = sequence.steps.first as! MotionGroup let subsequence = sequence.steps.last as! MotionSequence @@ -419,7 +419,7 @@ class MotionSequenceTests: XCTestCase { let sub_sequence = MotionSequence(steps: [motion3, motion4]) let motion5 = Motion(target: tester, properties: [PropertyData("value", 80.0)], duration: 0.2) - let sequence = MotionSequence(steps: [group, sub_sequence, motion5], options: [.Reverse]) + let sequence = MotionSequence(steps: [group, sub_sequence, motion5], options: [.reverses]) .reversed({ (sequence) in let motion = sequence.steps.last as! Motion let subsequence = sequence.steps[1] as! MotionSequence @@ -486,7 +486,7 @@ class MotionSequenceTests: XCTestCase { let motion3 = Motion(target: tester, properties: [PropertyData("value", 40.0)], duration: 0.2) let motion4 = Motion(target: tester, properties: [PropertyData("value", 60.0)], duration: 0.2) - let sequence = MotionSequence(steps: [group, motion3, motion4], options: [.Reverse]) + let sequence = MotionSequence(steps: [group, motion3, motion4], options: [.reverses]) .reversed({ (sequence) in let motion = sequence.steps.last as! Motion diff --git a/Tests/Tests/MotionTests.swift b/Tests/Tests/MotionTests.swift index c3e32ba..854bd53 100644 --- a/Tests/Tests/MotionTests.swift +++ b/Tests/Tests/MotionTests.swift @@ -287,7 +287,7 @@ class MotionTests: XCTestCase { let did_repeat = expectation(description: "motion called cycleRepeated notify closure") let did_complete = expectation(description: "motion called completed notify closure") - let motion = Motion(target: tester, properties: [PropertyData("value", 100.0)], duration: 0.2, options:[.Repeat]) + let motion = Motion(target: tester, properties: [PropertyData("value", 100.0)], duration: 0.2, options:[.repeats]) .cycleRepeated({ (motion) in XCTAssertEqual(motion.totalProgress, 0.5) XCTAssertEqual(motion.cycleProgress, 0.0) @@ -318,7 +318,7 @@ class MotionTests: XCTestCase { let did_reverse = expectation(description: "motion called reversed notify closure") let did_complete = expectation(description: "motion called completed notify closure") - let motion = Motion(target: tester, properties: [PropertyData("value", 100.0)], duration: 0.4, options:[.Reverse]) + let motion = Motion(target: tester, properties: [PropertyData("value", 100.0)], duration: 0.4, options:[.reverses]) .reversed({ (motion) in XCTAssertTrue(motion.totalProgress <= 0.5) XCTAssertTrue(motion.cycleProgress <= 0.5) @@ -348,7 +348,7 @@ class MotionTests: XCTestCase { let did_repeat = expectation(description: "motion called cycleRepeated notify closure") let did_complete = expectation(description: "motion called completed notify closure") - let motion = Motion(target: tester, properties: [PropertyData("value", 100.0)], duration: 0.4, options:[.Reverse, .Repeat]) + let motion = Motion(target: tester, properties: [PropertyData("value", 100.0)], duration: 0.4, options:[.reverses, .repeats]) .reversed({ (motion) in if (motion.cyclesCompletedCount == 0) { XCTAssertTrue(motion.totalProgress <= 0.25) diff --git a/Tests/Tests/PhysicsMotionTests.swift b/Tests/Tests/PhysicsMotionTests.swift index dee0a77..86ec8f6 100644 --- a/Tests/Tests/PhysicsMotionTests.swift +++ b/Tests/Tests/PhysicsMotionTests.swift @@ -163,7 +163,7 @@ class PhysicsMotionTests: XCTestCase { let did_repeat = expectation(description: "motion called cycleRepeated notify closure") let did_complete = expectation(description: "motion called completed notify closure") - let motion = PhysicsMotion(target: tester, properties: [PropertyData("value")], velocity: 2.0, friction: 0.98, options: [.Repeat]) + let motion = PhysicsMotion(target: tester, properties: [PropertyData("value")], velocity: 2.0, friction: 0.98, options: [.repeats]) .cycleRepeated({ (motion) in XCTAssertEqual(motion.totalProgress, 0.5) XCTAssertEqual(motion.cycleProgress, 0.0) @@ -192,7 +192,7 @@ class PhysicsMotionTests: XCTestCase { let did_reverse = expectation(description: "motion called reversed notify closure") let did_complete = expectation(description: "motion called completed notify closure") - let motion = PhysicsMotion(target: tester, properties: [PropertyData("value")], velocity: 2.0, friction: 0.98, options: [.Reverse]) + let motion = PhysicsMotion(target: tester, properties: [PropertyData("value")], velocity: 2.0, friction: 0.98, options: [.reverses]) .reversed({ (motion) in XCTAssertTrue(motion.totalProgress <= 0.5) XCTAssertTrue(motion.cycleProgress <= 0.5) @@ -220,7 +220,7 @@ class PhysicsMotionTests: XCTestCase { let did_repeat = expectation(description: "motion called cycleRepeated notify closure") let did_complete = expectation(description: "motion called completed notify closure") - let motion = PhysicsMotion(target: tester, properties: [PropertyData("value")], velocity: 2.0, friction: 0.98, options: [.Reverse, .Repeat]) + let motion = PhysicsMotion(target: tester, properties: [PropertyData("value")], velocity: 2.0, friction: 0.98, options: [.reverses, .repeats]) .reversed({ (motion) in if (motion.cyclesCompletedCount == 0) { XCTAssertTrue(motion.totalProgress <= 0.25)