From 133463efac800de0bfe8b01010fba43f7c62b10d Mon Sep 17 00:00:00 2001 From: Sarath Unni Date: Sun, 28 Apr 2019 14:29:07 +0300 Subject: [PATCH] Swift 5 syntax changes --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ .../SkyFloatingLabelTextField.xcodeproj/project.pbxproj | 5 +++-- Sources/SkyFloatingLabelTextField.swift | 6 +++--- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 SkyFloatingLabelTextField.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/SkyFloatingLabelTextField.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SkyFloatingLabelTextField.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SkyFloatingLabelTextField.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SkyFloatingLabelTextField/SkyFloatingLabelTextField.xcodeproj/project.pbxproj b/SkyFloatingLabelTextField/SkyFloatingLabelTextField.xcodeproj/project.pbxproj index 5787256..63f8e8e 100644 --- a/SkyFloatingLabelTextField/SkyFloatingLabelTextField.xcodeproj/project.pbxproj +++ b/SkyFloatingLabelTextField/SkyFloatingLabelTextField.xcodeproj/project.pbxproj @@ -341,6 +341,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, he, @@ -632,7 +633,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -653,7 +654,7 @@ PRODUCT_BUNDLE_IDENTIFIER = net.skyscanner.SkyFloatingLabelTextField; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Sources/SkyFloatingLabelTextField.swift b/Sources/SkyFloatingLabelTextField.swift index 4a504dc..6254bfd 100644 --- a/Sources/SkyFloatingLabelTextField.swift +++ b/Sources/SkyFloatingLabelTextField.swift @@ -81,7 +81,7 @@ open class SkyFloatingLabelTextField: UITextField { // swiftlint:disable:this ty if let placeholder = placeholder, let font = placeholderFont ?? font { attributedPlaceholder = NSAttributedString( string: placeholder, - attributes: [NSForegroundColorAttributeName: placeholderColor, NSFontAttributeName: font] + attributes: [NSAttributedString.Key.foregroundColor: placeholderColor, NSAttributedString.Key.font: font] ) } } @@ -293,7 +293,7 @@ open class SkyFloatingLabelTextField: UITextField { // swiftlint:disable:this ty /** Invoked when the editing state of the textfield changes. Override to respond to this change. */ - open func editingChanged() { + @objc open func editingChanged() { //Remove Error Message if self.hasErrorMessage { self.errorMessage = "" @@ -468,7 +468,7 @@ open class SkyFloatingLabelTextField: UITextField { // swiftlint:disable:this ty self.titleLabel.frame = frame } if animated { - let animationOptions: UIViewAnimationOptions = .curveEaseOut + let animationOptions: UIView.AnimationOptions = .curveEaseOut let duration = isTitleVisible() ? titleFadeInDuration : titleFadeOutDuration UIView.animate(withDuration: duration, delay: 0, options: animationOptions, animations: { () -> Void in updateBlock()