diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 9f55b2c..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -3.0 diff --git a/DesignableButton/DesignableButton.xcodeproj/project.pbxproj b/DesignableButton/DesignableButton.xcodeproj/project.pbxproj index b5fa5ba..c8acf72 100644 --- a/DesignableButton/DesignableButton.xcodeproj/project.pbxproj +++ b/DesignableButton/DesignableButton.xcodeproj/project.pbxproj @@ -303,12 +303,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 2E23KCX8SU; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = DesignableButton/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.DesignableButton; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -317,12 +320,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 2E23KCX8SU; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = DesignableButton/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.DesignableButton; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/DesignableButton/DesignableButton/AppDelegate.swift b/DesignableButton/DesignableButton/AppDelegate.swift index 0ac8d92..8772af3 100644 --- a/DesignableButton/DesignableButton/AppDelegate.swift +++ b/DesignableButton/DesignableButton/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. DesignableButton.setDesignableStyles() diff --git a/DesignableButton/DesignableButton/DesignableButton+Styles.swift b/DesignableButton/DesignableButton/DesignableButton+Styles.swift index 901663b..6a1aabc 100644 --- a/DesignableButton/DesignableButton/DesignableButton+Styles.swift +++ b/DesignableButton/DesignableButton/DesignableButton+Styles.swift @@ -21,18 +21,18 @@ extension DesignableButton { DesignableButton.setStyle(style: { (designableButton: DesignableButton) -> Void in if designableButton.isHighlighted || designableButton.isSelected { - designableButton.setTitleColor(designableButton.customTextColor ?? UIColor.white, for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? UIColor.white, for: UIControl.State()) designableButton.backgroundColor = designableButton.selectedColor ?? Color.redSelected() designableButton.layer.borderColor = designableButton.selectedColor?.cgColor ?? Color.redSelected().cgColor designableButton.layer.borderWidth = designableButton.borderWidth ?? 0 } else if designableButton.isEnabled { - designableButton.setTitleColor(designableButton.customTextColor ?? UIColor.white, for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? UIColor.white, for: UIControl.State()) designableButton.backgroundColor = designableButton.defaultColor ?? Color.red() designableButton.layer.borderColor = designableButton.defaultColor?.cgColor ?? Color.red().cgColor designableButton.layer.borderWidth = designableButton.borderWidth ?? 0 } else { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.gray(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.gray(), for: UIControl.State()) designableButton.backgroundColor = designableButton.disabledColor ?? Color.grayLightest() designableButton.layer.borderColor = designableButton.borderColor?.cgColor ?? Color.gray().cgColor designableButton.layer.borderWidth = designableButton.borderWidth ?? 1 @@ -45,14 +45,14 @@ extension DesignableButton { DesignableButton.setStyle(style: { (designableButton: DesignableButton) -> Void in if designableButton.isHighlighted || designableButton.isSelected { - designableButton.setTitleColor(designableButton.customTextColor ?? UIColor.white, for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? UIColor.white, for: UIControl.State()) designableButton.backgroundColor = designableButton.selectedColor ?? Color.redSelected() } else if designableButton.isEnabled { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.red(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.red(), for: UIControl.State()) designableButton.backgroundColor = designableButton.defaultColor ?? UIColor.white } else { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.grayLight(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.grayLight(), for: UIControl.State()) designableButton.backgroundColor = designableButton.disabledColor ?? Color.grayLightest() } designableButton.setTitle(designableButton.titleLabel?.text, for: .normal) @@ -64,27 +64,27 @@ extension DesignableButton { DesignableButton.setStyle(style: { (designableButton: DesignableButton) -> Void in if designableButton.isHighlighted { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.redSelected(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.redSelected(), for: UIControl.State()) designableButton.backgroundColor = designableButton.selectedColor ?? Color.red() designableButton.tintColor = Color.redSelected() } else if designableButton.isSelected { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.redSelected(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.redSelected(), for: UIControl.State()) designableButton.backgroundColor = designableButton.selectedColor ?? UIColor.clear designableButton.tintColor = Color.redSelected() } else if designableButton.isEnabled { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.red(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.red(), for: UIControl.State()) designableButton.backgroundColor = designableButton.defaultColor ?? UIColor.clear designableButton.tintColor = Color.red() } else { - designableButton.setTitleColor(designableButton.customTextColor ?? Color.grayLight(), for: UIControlState()) + designableButton.setTitleColor(designableButton.customTextColor ?? Color.grayLight(), for: UIControl.State()) designableButton.backgroundColor = designableButton.disabledColor ?? UIColor.clear designableButton.tintColor = Color.grayLight() } if isInterfaceBuilder { - designableButton.setImage(designableButton.image(for: .normal)?.withRenderingMode(UIImageRenderingMode.alwaysTemplate), for: .normal) + designableButton.setImage(designableButton.image(for: .normal)?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate), for: .normal) } designableButton.alignImageAndTitleVertically() diff --git a/IHDesignableButton.podspec b/IHDesignableButton.podspec index fd00740..fce4482 100644 --- a/IHDesignableButton.podspec +++ b/IHDesignableButton.podspec @@ -23,4 +23,6 @@ Common button styles, such as corner radius, are also made available in Interfac s.framework = "UIKit" s.requires_arc = true + + s.swift_version = '4.2' end diff --git a/Sources/DesignableButton.swift b/Sources/DesignableButton.swift index 168e678..2312dc9 100644 --- a/Sources/DesignableButton.swift +++ b/Sources/DesignableButton.swift @@ -133,13 +133,13 @@ open class DesignableButton: UIButton { if self.adjustsFontSizeToFitWidth { // When dynamic text changes we need to redraw the layout - NotificationCenter.default.addObserver(forName: .UIContentSizeCategoryDidChange, object: nil, queue: OperationQueue.main) { [weak self] notification in + NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in guard let strongSelf = self else { return } strongSelf.setNeedsLayout() } } else { - NotificationCenter.default.removeObserver(self, name: .UIContentSizeCategoryDidChange, object: nil) + NotificationCenter.default.removeObserver(self, name: UIContentSizeCategory.didChangeNotification, object: nil) } } } @@ -172,7 +172,7 @@ open class DesignableButton: UIButton { layer.masksToBounds = layer.cornerRadius > 0 - assert(self.buttonType == UIButtonType.custom, "Designable Button \"\(self.titleLabel?.text ?? "?")\" buttonType must be Custom") + assert(self.buttonType == UIButton.ButtonType.custom, "Designable Button \"\(self.titleLabel?.text ?? "?")\" buttonType must be Custom") } }