From 55178cf633a8f3df658b028ce706a43523ab7dcf Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:10:31 +0200 Subject: [PATCH 01/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 0e0a343..b970240 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -public enum StopAnimationStyle { +@objc public enum StopAnimationStyle { case normal case expand case shake @@ -93,7 +93,7 @@ public enum StopAnimationStyle { /** start animating the button, before starting a task, exemple: before a network call. */ - open func startAnimation() { + @objc open func startAnimation() { self.isUserInteractionEnabled = false // Disable the user interaction during the animation self.cachedTitle = title(for: .normal) // cache title before animation of spiner self.cachedImage = image(for: .normal) // cache image before animation of spiner @@ -117,7 +117,7 @@ public enum StopAnimationStyle { - Parameter completion: a callback closure to be called once the animation finished, it may be useful to transit to another view controller, example transit to the home screen from the login screen. */ - open func stopAnimation(animationStyle:StopAnimationStyle = .normal, revertAfterDelay delay: TimeInterval = 1.0, completion:(()->Void)? = nil) { + @objc open func stopAnimation(animationStyle:StopAnimationStyle = .normal, revertAfterDelay delay: TimeInterval = 1.0, completion:(()->Void)? = nil) { let delayToRevert = max(delay, 0.2) From debaa35c77e5fd349540a12ecd2ae21ceb97d9d3 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:22:30 +0200 Subject: [PATCH 02/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index b970240..296934e 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -@objc public enum StopAnimationStyle { +public enum StopAnimationStyle { case normal case expand case shake From 192ab27fe1154928641f6b81aa6831123539bd89 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:24:44 +0200 Subject: [PATCH 03/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 296934e..cf42d66 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -public enum StopAnimationStyle { +@objc enum StopAnimationStyle { case normal case expand case shake From 4f3929f06cc6d31e840a46f4c16d36d3aa5a8387 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:28:54 +0200 Subject: [PATCH 04/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index cf42d66..b31a09a 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -@objc enum StopAnimationStyle { +@objc public enum StopAnimationStyle : Int{ case normal case expand case shake From dc48e74d268b16d80a8818cacef08f16c25a7d52 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:31:56 +0200 Subject: [PATCH 05/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index b31a09a..03372fa 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -@objc public enum StopAnimationStyle : Int{ +@objc enum StopAnimationStyle : Int{ case normal case expand case shake From c19f251c5ac94987bd02e6e79aef7c2d7d84c828 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:37:32 +0200 Subject: [PATCH 06/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 03372fa..80a9467 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -@objc enum StopAnimationStyle : Int{ +@objc enum StopAnimationStyle:Int{ case normal case expand case shake From a377c78dae0e1bee19b18421d64d820147a514cc Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:39:51 +0200 Subject: [PATCH 07/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 80a9467..36eea0e 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -@objc enum StopAnimationStyle:Int{ +public enum StopAnimationStyle{ case normal case expand case shake From 78787576393ac53689a9f3bb0ccbf1edc095eee5 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 20:49:14 +0200 Subject: [PATCH 08/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 36eea0e..80a9467 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -public enum StopAnimationStyle{ +@objc enum StopAnimationStyle:Int{ case normal case expand case shake From 15b1b7b601aa2be30079bef777ac70e75894819e Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Wed, 24 Oct 2018 21:14:32 +0200 Subject: [PATCH 09/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 80a9467..6a47303 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -16,7 +16,7 @@ Stop animation style of the `TransitionButton`. - expand: expand the button and cover all the screen, useful to do transit animation. - shake: revert the button to original state and make a shaoe animation, useful to reflect that something went wrong */ -@objc enum StopAnimationStyle:Int{ +@objc public enum StopAnimationStyle:Int{ case normal case expand case shake From ff97dd8c1b1917957cff6cbb8588617d6baec2c9 Mon Sep 17 00:00:00 2001 From: Jonathan Mayunga Date: Fri, 9 Nov 2018 21:48:02 +0200 Subject: [PATCH 10/25] Update TransitionButton.swift --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 6a47303..1d40aac 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -166,7 +166,7 @@ Stop animation style of the `TransitionButton`. private func setOriginalState(completion:(()->Void)?) { self.animateToOriginalWidth(completion: completion) self.spiner.stopAnimation() - self.setTitle(self.cachedTitle, for: .normal) + self.setTitle("OOOUS", for: .normal) self.setImage(self.cachedImage, for: .normal) self.isUserInteractionEnabled = true // enable again the user interaction self.layer.cornerRadius = self.cornerRadius From ee8166da7213f9afe715f4cca7b36f6e36934c5b Mon Sep 17 00:00:00 2001 From: dcoletto Date: Mon, 4 Feb 2019 17:31:43 +0100 Subject: [PATCH 11/25] Using constants for CAMediaTimingFunction and CAFillMode --- Source/SpinerLayer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/SpinerLayer.swift b/Source/SpinerLayer.swift index b804b3e..a8d61b5 100755 --- a/Source/SpinerLayer.swift +++ b/Source/SpinerLayer.swift @@ -45,10 +45,10 @@ class SpinerLayer: CAShapeLayer { rotate.fromValue = 0 rotate.toValue = Double.pi * 2 rotate.duration = 0.4 - rotate.timingFunction = CAMediaTimingFunction(name: .linear) + rotate.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) rotate.repeatCount = HUGE - rotate.fillMode = .forwards + rotate.fillMode = kCAFillModeForwards rotate.isRemovedOnCompletion = false self.add(rotate, forKey: rotate.keyPath) From 393fe65622152b6fd0d6ded7962b394651f68ba4 Mon Sep 17 00:00:00 2001 From: dcoletto Date: Mon, 4 Feb 2019 17:34:33 +0100 Subject: [PATCH 12/25] Constants for CAMediaTimingFunction and CAFillMode --- Source/TransitionButton.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 0e0a343..1cfeeeb 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -61,7 +61,7 @@ public enum StopAnimationStyle { private var cachedImage: UIImage? private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92) - private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: .linear) + private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) private let expandCurve:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.95, 0.02, 1, 0.05) private let shrinkDuration: CFTimeInterval = 0.1 @@ -151,7 +151,7 @@ public enum StopAnimationStyle { NSValue(cgPoint: CGPoint(x: CGFloat(point.x + 10), y: CGFloat(point.y))), NSValue(cgPoint: point)] - keyFrame.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + keyFrame.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) keyFrame.duration = 0.7 self.layer.position = point @@ -178,7 +178,7 @@ public enum StopAnimationStyle { shrinkAnim.toValue = (self.bounds.width) shrinkAnim.duration = shrinkDuration shrinkAnim.timingFunction = shrinkCurve - shrinkAnim.fillMode = .forwards + shrinkAnim.fillMode = kCAFillModeForwards shrinkAnim.isRemovedOnCompletion = false CATransaction.setCompletionBlock { @@ -195,7 +195,7 @@ public enum StopAnimationStyle { shrinkAnim.toValue = frame.height shrinkAnim.duration = shrinkDuration shrinkAnim.timingFunction = shrinkCurve - shrinkAnim.fillMode = .forwards + shrinkAnim.fillMode = kCAFillModeForwards shrinkAnim.isRemovedOnCompletion = false layer.add(shrinkAnim, forKey: shrinkAnim.keyPath) @@ -209,7 +209,7 @@ public enum StopAnimationStyle { expandAnim.toValue = max(expandScale,26.0) expandAnim.timingFunction = expandCurve expandAnim.duration = 0.4 - expandAnim.fillMode = .forwards + expandAnim.fillMode = kCAFillModeForwards expandAnim.isRemovedOnCompletion = false CATransaction.setCompletionBlock { From 4d6a59fe12f8bfbe916525c5e2d559a9bdb7a37e Mon Sep 17 00:00:00 2001 From: Beygel <> Date: Tue, 5 Feb 2019 12:37:15 +0200 Subject: [PATCH 13/25] * added cachedBounds property for after stopping animation --------------------------------------- --- Source/TransitionButton.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 0e0a343..176a40e 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -59,6 +59,7 @@ public enum StopAnimationStyle { private var cachedTitle: String? private var cachedImage: UIImage? + private var cachedBounds: CGRect! private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92) private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: .linear) @@ -97,6 +98,7 @@ public enum StopAnimationStyle { self.isUserInteractionEnabled = false // Disable the user interaction during the animation self.cachedTitle = title(for: .normal) // cache title before animation of spiner self.cachedImage = image(for: .normal) // cache image before animation of spiner + self.cachedBounds = bounds self.setTitle("", for: .normal) // place an empty string as title to display a spiner self.setImage(nil, for: .normal) // remove the image, if any, before displaying the spinner @@ -175,7 +177,7 @@ public enum StopAnimationStyle { private func animateToOriginalWidth(completion:(()->Void)?) { let shrinkAnim = CABasicAnimation(keyPath: "bounds.size.width") shrinkAnim.fromValue = (self.bounds.height) - shrinkAnim.toValue = (self.bounds.width) + shrinkAnim.toValue = self.cachedBounds.width shrinkAnim.duration = shrinkDuration shrinkAnim.timingFunction = shrinkCurve shrinkAnim.fillMode = .forwards From 9ed5f04603ad1c7514dce0fb05f794d1c74c00bf Mon Sep 17 00:00:00 2001 From: robert jenkins Date: Sat, 27 Apr 2019 20:49:41 +0300 Subject: [PATCH 14/25] Swift 5.0 --- Source/TransitionButton.swift | 2 +- TransitionButton.xcodeproj/project.pbxproj | 19 ++++++++----------- .../xcschemes/TransitionButton.xcscheme | 2 +- .../iOS Example.xcodeproj/project.pbxproj | 6 ++++-- .../xcschemes/iOS Example.xcscheme | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 0e0a343..edb28a3 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -230,7 +230,7 @@ public enum StopAnimationStyle { public extension UIImage { - public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) { + convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) { let rect = CGRect(origin: .zero, size: size) UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0) color.setFill() diff --git a/TransitionButton.xcodeproj/project.pbxproj b/TransitionButton.xcodeproj/project.pbxproj index dd03b41..f892ae8 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -167,22 +167,23 @@ TargetAttributes = { D93F1C971EAEDB6E009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; D93F1CA01EAEDB6E009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = D93F1C921EAEDB6E009A7474 /* Build configuration list for PBXProject "TransitionButton" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = D93F1C8E1EAEDB6E009A7474; productRefGroup = D93F1C991EAEDB6E009A7474 /* Products */; @@ -381,8 +382,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -403,8 +403,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -417,8 +416,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButtonTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -431,8 +429,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButtonTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/TransitionButton.xcodeproj/xcshareddata/xcschemes/TransitionButton.xcscheme b/TransitionButton.xcodeproj/xcshareddata/xcschemes/TransitionButton.xcscheme index 931465d..7d40257 100755 --- a/TransitionButton.xcodeproj/xcshareddata/xcschemes/TransitionButton.xcscheme +++ b/TransitionButton.xcodeproj/xcshareddata/xcschemes/TransitionButton.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 18 Jul 2019 15:26:17 +0545 Subject: [PATCH 15/25] 1. Migrated code base to Swift 5.0 2. Added ability to change final transition animation duration --- Source/TransitionButton.swift | 4 +++- TransitionButton.xcodeproj/project.pbxproj | 19 ++++++++----------- iOS Example/Source/FirstViewController.swift | 1 + .../iOS Example.xcodeproj/project.pbxproj | 9 ++++----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 0e0a343..965faec 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -51,6 +51,8 @@ public enum StopAnimationStyle { } } + @IBInspectable open var finishAnimationDuration = 0.4 + private lazy var spiner: SpinerLayer = { let spiner = SpinerLayer(frame: self.frame) self.layer.addSublayer(spiner) @@ -208,7 +210,7 @@ public enum StopAnimationStyle { expandAnim.fromValue = 1.0 expandAnim.toValue = max(expandScale,26.0) expandAnim.timingFunction = expandCurve - expandAnim.duration = 0.4 + expandAnim.duration = finishAnimationDuration expandAnim.fillMode = .forwards expandAnim.isRemovedOnCompletion = false diff --git a/TransitionButton.xcodeproj/project.pbxproj b/TransitionButton.xcodeproj/project.pbxproj index dd03b41..f892ae8 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -167,22 +167,23 @@ TargetAttributes = { D93F1C971EAEDB6E009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; D93F1CA01EAEDB6E009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = D93F1C921EAEDB6E009A7474 /* Build configuration list for PBXProject "TransitionButton" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = D93F1C8E1EAEDB6E009A7474; productRefGroup = D93F1C991EAEDB6E009A7474 /* Products */; @@ -381,8 +382,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -403,8 +403,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -417,8 +416,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButtonTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -431,8 +429,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButtonTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/iOS Example/Source/FirstViewController.swift b/iOS Example/Source/FirstViewController.swift index 80ab730..f8b2550 100644 --- a/iOS Example/Source/FirstViewController.swift +++ b/iOS Example/Source/FirstViewController.swift @@ -13,6 +13,7 @@ class FirstViewController: UIViewController { @IBAction func buttonAction(_ button: TransitionButton) { button.startAnimation() // 2: Then start the animation when the user tap the button + button.finishAnimationDuration = 0.6 let qualityOfServiceClass = DispatchQoS.QoSClass.background let backgroundQueue = DispatchQueue.global(qos: qualityOfServiceClass) backgroundQueue.async(execute: { diff --git a/iOS Example/iOS Example.xcodeproj/project.pbxproj b/iOS Example/iOS Example.xcodeproj/project.pbxproj index af1dc44..2ecbe6b 100755 --- a/iOS Example/iOS Example.xcodeproj/project.pbxproj +++ b/iOS Example/iOS Example.xcodeproj/project.pbxproj @@ -127,7 +127,7 @@ TargetAttributes = { D93F1CBF1EAEDD3F009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; @@ -137,6 +137,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -306,8 +307,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.itechnodev.iOS-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -326,8 +326,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.itechnodev.iOS-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; From dd37f5d253d070ff12e486d93e76a4cd0733db24 Mon Sep 17 00:00:00 2001 From: savana kranth Date: Thu, 18 Jul 2019 15:32:44 +0545 Subject: [PATCH 16/25] 1. Updated pod version --- TransitionButton.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TransitionButton.podspec b/TransitionButton.podspec index d22ddb2..db887f2 100755 --- a/TransitionButton.podspec +++ b/TransitionButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TransitionButton' - s.version = '0.5.2' + s.version = '0.6' s.summary = 'UIButton sublass for loading and transition animation.' s.description = <<-DESC From c47175b3d3391321b3c13f8da98f3d4a4f7cdb7e Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 24 Oct 2019 14:08:41 +0300 Subject: [PATCH 17/25] - Resolve error --- Source/Info.plist | 2 +- Source/SpinerLayer.swift | 4 ++-- Source/TransitionButton.swift | 10 +++++----- TransitionButton.xcodeproj/project.pbxproj | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/Info.plist b/Source/Info.plist index daca151..ec0cc7b 100755 --- a/Source/Info.plist +++ b/Source/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.5.2 + $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Source/SpinerLayer.swift b/Source/SpinerLayer.swift index a8d61b5..35ac336 100755 --- a/Source/SpinerLayer.swift +++ b/Source/SpinerLayer.swift @@ -45,10 +45,10 @@ class SpinerLayer: CAShapeLayer { rotate.fromValue = 0 rotate.toValue = Double.pi * 2 rotate.duration = 0.4 - rotate.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + rotate.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) rotate.repeatCount = HUGE - rotate.fillMode = kCAFillModeForwards + rotate.fillMode = CAMediaTimingFillMode.forwards rotate.isRemovedOnCompletion = false self.add(rotate, forKey: rotate.keyPath) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index b83a659..5b038d7 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -62,7 +62,7 @@ Stop animation style of the `TransitionButton`. private var cachedBounds: CGRect! private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92) - private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) private let expandCurve:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.95, 0.02, 1, 0.05) private let shrinkDuration: CFTimeInterval = 0.1 @@ -153,7 +153,7 @@ Stop animation style of the `TransitionButton`. NSValue(cgPoint: CGPoint(x: CGFloat(point.x + 10), y: CGFloat(point.y))), NSValue(cgPoint: point)] - keyFrame.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + keyFrame.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) keyFrame.duration = 0.7 self.layer.position = point @@ -180,7 +180,7 @@ Stop animation style of the `TransitionButton`. shrinkAnim.toValue = self.cachedBounds.width shrinkAnim.duration = shrinkDuration shrinkAnim.timingFunction = shrinkCurve - shrinkAnim.fillMode = kCAFillModeForwards + shrinkAnim.fillMode = CAMediaTimingFillMode.forwards shrinkAnim.isRemovedOnCompletion = false CATransaction.setCompletionBlock { @@ -197,7 +197,7 @@ Stop animation style of the `TransitionButton`. shrinkAnim.toValue = frame.height shrinkAnim.duration = shrinkDuration shrinkAnim.timingFunction = shrinkCurve - shrinkAnim.fillMode = kCAFillModeForwards + shrinkAnim.fillMode = CAMediaTimingFillMode.forwards shrinkAnim.isRemovedOnCompletion = false layer.add(shrinkAnim, forKey: shrinkAnim.keyPath) @@ -211,7 +211,7 @@ Stop animation style of the `TransitionButton`. expandAnim.toValue = max(expandScale,26.0) expandAnim.timingFunction = expandCurve expandAnim.duration = 0.4 - expandAnim.fillMode = kCAFillModeForwards + expandAnim.fillMode = CAMediaTimingFillMode.forwards expandAnim.isRemovedOnCompletion = false CATransaction.setCompletionBlock { diff --git a/TransitionButton.xcodeproj/project.pbxproj b/TransitionButton.xcodeproj/project.pbxproj index f892ae8..ed63f65 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -378,6 +378,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.6.0; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -400,6 +401,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 0.6.0; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; From 3b7537b76c3e22802933b3501df472c0ececc9bf Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 24 Oct 2019 14:09:25 +0300 Subject: [PATCH 18/25] - Update version --- TransitionButton.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TransitionButton.xcodeproj/project.pbxproj b/TransitionButton.xcodeproj/project.pbxproj index ed63f65..d651578 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -378,7 +378,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.6.0; + MARKETING_VERSION = 0.6.1; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -401,7 +401,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.6.0; + MARKETING_VERSION = 0.6.1; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; From 768de530dbb2fb399ad457846255511f8f0f1d61 Mon Sep 17 00:00:00 2001 From: wowansm Date: Thu, 24 Oct 2019 14:14:53 +0300 Subject: [PATCH 19/25] Update TransitionButton.podspec --- TransitionButton.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TransitionButton.podspec b/TransitionButton.podspec index db887f2..498ea1e 100755 --- a/TransitionButton.podspec +++ b/TransitionButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TransitionButton' - s.version = '0.6' + s.version = '0.6.1' s.summary = 'UIButton sublass for loading and transition animation.' s.description = <<-DESC From 2acc6e69719a4c6386e1072e10ce8f937824ecda Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 24 Oct 2019 14:39:31 +0300 Subject: [PATCH 20/25] - Fix Cached title --- Source/TransitionButton.swift | 2 +- TransitionButton.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 69e2833..74e7848 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -170,7 +170,7 @@ Stop animation style of the `TransitionButton`. private func setOriginalState(completion:(()->Void)?) { self.animateToOriginalWidth(completion: completion) self.spiner.stopAnimation() - self.setTitle("OOOUS", for: .normal) + self.setTitle(cachedTitle, for: .normal) self.setImage(self.cachedImage, for: .normal) self.isUserInteractionEnabled = true // enable again the user interaction self.layer.cornerRadius = self.cornerRadius diff --git a/TransitionButton.xcodeproj/project.pbxproj b/TransitionButton.xcodeproj/project.pbxproj index d651578..573ef4f 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -378,7 +378,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.6.1; + MARKETING_VERSION = 0.6.2; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -401,7 +401,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.6.1; + MARKETING_VERSION = 0.6.2; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; From 41766629421ff5ceb39d32b01c029f1cb41c0a24 Mon Sep 17 00:00:00 2001 From: wowansm Date: Thu, 24 Oct 2019 14:40:06 +0300 Subject: [PATCH 21/25] Update TransitionButton.podspec --- TransitionButton.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TransitionButton.podspec b/TransitionButton.podspec index 498ea1e..12ebb03 100755 --- a/TransitionButton.podspec +++ b/TransitionButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TransitionButton' - s.version = '0.6.1' + s.version = '0.6.2' s.summary = 'UIButton sublass for loading and transition animation.' s.description = <<-DESC From 529eeaaf201f3ea0ea103be49d7088519b3e9a4d Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 24 Oct 2019 15:13:58 +0300 Subject: [PATCH 22/25] - add isAnimation property --- Source/TransitionButton.swift | 3 +++ TransitionButton.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 74e7848..11f741d 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -62,6 +62,7 @@ Stop animation style of the `TransitionButton`. private var cachedTitle: String? private var cachedImage: UIImage? private var cachedBounds: CGRect! + private var isAnimation: Bool = false private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92) private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) @@ -101,6 +102,7 @@ Stop animation style of the `TransitionButton`. self.cachedTitle = title(for: .normal) // cache title before animation of spiner self.cachedImage = image(for: .normal) // cache image before animation of spiner self.cachedBounds = bounds + self.isAnimation = true self.setTitle("", for: .normal) // place an empty string as title to display a spiner self.setImage(nil, for: .normal) // remove the image, if any, before displaying the spinner @@ -124,6 +126,7 @@ Stop animation style of the `TransitionButton`. @objc open func stopAnimation(animationStyle:StopAnimationStyle = .normal, revertAfterDelay delay: TimeInterval = 1.0, completion:(()->Void)? = nil) { let delayToRevert = max(delay, 0.2) + self.isAnimation = false switch animationStyle { case .normal: diff --git a/TransitionButton.xcodeproj/project.pbxproj b/TransitionButton.xcodeproj/project.pbxproj index 573ef4f..2e1bf65 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -378,7 +378,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.6.2; + MARKETING_VERSION = 0.6.3; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -401,7 +401,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 0.6.2; + MARKETING_VERSION = 0.6.3; PRODUCT_BUNDLE_IDENTIFIER = com.itechnodev.TransitionButton; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; From b2fb545a90caee1b45a01d035890016e47af8665 Mon Sep 17 00:00:00 2001 From: wowansm Date: Thu, 24 Oct 2019 15:14:44 +0300 Subject: [PATCH 23/25] Update TransitionButton.podspec --- TransitionButton.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TransitionButton.podspec b/TransitionButton.podspec index 12ebb03..aba9c16 100755 --- a/TransitionButton.podspec +++ b/TransitionButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TransitionButton' - s.version = '0.6.2' + s.version = '0.6.3' s.summary = 'UIButton sublass for loading and transition animation.' s.description = <<-DESC From 2f20d548d754ee2cc486d847bbd8ec0f7b30348b Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 24 Oct 2019 15:17:29 +0300 Subject: [PATCH 24/25] - remove private from isAnimation --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 11f741d..ffd77aa 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -62,7 +62,7 @@ Stop animation style of the `TransitionButton`. private var cachedTitle: String? private var cachedImage: UIImage? private var cachedBounds: CGRect! - private var isAnimation: Bool = false + var isAnimation: Bool = false private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92) private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) From 837b89f8a49c05fdbf19e4c431949a555c4bb4f1 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 24 Oct 2019 15:24:16 +0300 Subject: [PATCH 25/25] - set public isAnimation property --- Source/TransitionButton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index ffd77aa..6fc88b3 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -62,7 +62,7 @@ Stop animation style of the `TransitionButton`. private var cachedTitle: String? private var cachedImage: UIImage? private var cachedBounds: CGRect! - var isAnimation: Bool = false + public var isAnimation: Bool = false private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92) private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)