From a79a1e7e6a663a9395596f473e622cc04dd20cce Mon Sep 17 00:00:00 2001 From: szubyak Date: Mon, 8 Jul 2019 12:44:12 +0300 Subject: [PATCH 1/2] Add isAnimating property --- Source/TransitionButton.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 0e0a343..18ba5ec 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -51,6 +51,8 @@ public enum StopAnimationStyle { } } + open private(set) var isAnimating = false + private lazy var spiner: SpinerLayer = { let spiner = SpinerLayer(frame: self.frame) self.layer.addSublayer(spiner) @@ -101,6 +103,8 @@ public enum StopAnimationStyle { 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 + self.isAnimating = true + UIView.animate(withDuration: 0.1, animations: { () -> Void in self.layer.cornerRadius = self.frame.height / 2 // corner radius should be half the height to have a circle corners }, completion: { completed -> Void in @@ -119,6 +123,7 @@ public enum StopAnimationStyle { */ open func stopAnimation(animationStyle:StopAnimationStyle = .normal, revertAfterDelay delay: TimeInterval = 1.0, completion:(()->Void)? = nil) { + self.isAnimating = false let delayToRevert = max(delay, 0.2) switch animationStyle { From e4a90233f868a1cf7d0246dd4cfe34bea6f91f24 Mon Sep 17 00:00:00 2001 From: szubyak Date: Fri, 2 Aug 2019 13:55:26 +0300 Subject: [PATCH 2/2] Updated to Swift 5.0 --- Source/TransitionButton.swift | 2 +- TransitionButton.xcodeproj/project.pbxproj | 23 +++++++++---------- .../xcschemes/TransitionButton.xcscheme | 2 +- .../iOS Example.xcodeproj/project.pbxproj | 6 +++-- .../xcschemes/iOS Example.xcscheme | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Source/TransitionButton.swift b/Source/TransitionButton.swift index 18ba5ec..37cb8ed 100755 --- a/Source/TransitionButton.swift +++ b/Source/TransitionButton.swift @@ -235,7 +235,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..74973a8 100755 --- a/TransitionButton.xcodeproj/project.pbxproj +++ b/TransitionButton.xcodeproj/project.pbxproj @@ -162,27 +162,28 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0940; + LastUpgradeCheck = 1030; ORGANIZATIONNAME = ITechnoDev; TargetAttributes = { D93F1C971EAEDB6E009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1030; ProvisioningStyle = Automatic; }; D93F1CA01EAEDB6E009A7474 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1030; 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 */; @@ -248,6 +249,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -311,6 +313,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -381,8 +384,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 +405,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 +418,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 +431,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..4332438 100755 --- a/TransitionButton.xcodeproj/xcshareddata/xcschemes/TransitionButton.xcscheme +++ b/TransitionButton.xcodeproj/xcshareddata/xcschemes/TransitionButton.xcscheme @@ -1,6 +1,6 @@