From a3d937f2afef44389094836a140c47d3de863516 Mon Sep 17 00:00:00 2001 From: Meng To Date: Tue, 4 Apr 2017 15:01:41 -0400 Subject: [PATCH 01/20] Xcode 8.3 update --- Spring/Misc.swift | 4 ++-- Spring/Spring.swift | 6 +++--- SpringApp.xcodeproj/project.pbxproj | 8 +++++++- .../xcshareddata/xcschemes/Spring.xcscheme | 2 +- .../xcshareddata/xcschemes/SpringApp.xcscheme | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Spring/Misc.swift b/Spring/Misc.swift index 234f268..b6af7d5 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -43,7 +43,7 @@ public func htmlToAttributedString(text: String) -> NSAttributedString! { } public func degreesToRadians(degrees: CGFloat) -> CGFloat { - return degrees * CGFloat(M_PI / 180) + return degrees * CGFloat(CGFloat.pi / 180) } public func delay(delay:Double, closure: @escaping ()->()) { @@ -202,7 +202,7 @@ public func timeAgoSinceDate(date: Date, numericDates: Bool) -> String { return "1w" } } else if (day >= 2) { - return "\(components.day)d" + return "\(components.day ?? 2)d" } else if (day >= 1){ if (numericDates){ return "1d" diff --git a/Spring/Spring.swift b/Spring/Spring.swift index 46819b1..a6ffff0 100644 --- a/Spring/Spring.swift +++ b/Spring/Spring.swift @@ -227,7 +227,7 @@ public class Spring : NSObject { scaleY = 2*force case .Fall: animateFrom = false - rotate = 15 * CGFloat(M_PI/180) + rotate = 15 * CGFloat(CGFloat.pi/180) y = 600*force case .Shake: let animation = CAKeyframeAnimation() @@ -262,7 +262,7 @@ public class Spring : NSObject { animation.keyPath = "transform" animation.fromValue = NSValue(caTransform3D: CATransform3DMakeRotation(0, 0, 0, 0)) animation.toValue = NSValue(caTransform3D: - CATransform3DConcat(perspective, CATransform3DMakeRotation(CGFloat(M_PI), 0, 1, 0))) + CATransform3DConcat(perspective, CATransform3DMakeRotation(CGFloat(CGFloat.pi), 0, 1, 0))) animation.duration = CFTimeInterval(duration) animation.beginTime = CACurrentMediaTime() + CFTimeInterval(delay) animation.timingFunction = getTimingFunction(curve: curve) @@ -276,7 +276,7 @@ public class Spring : NSObject { animation.fromValue = NSValue(caTransform3D: CATransform3DMakeRotation(0, 0, 0, 0)) animation.toValue = NSValue(caTransform3D: - CATransform3DConcat(perspective,CATransform3DMakeRotation(CGFloat(M_PI), 1, 0, 0))) + CATransform3DConcat(perspective,CATransform3DMakeRotation(CGFloat(CGFloat.pi), 1, 0, 0))) animation.duration = CFTimeInterval(duration) animation.beginTime = CACurrentMediaTime() + CFTimeInterval(delay) animation.timingFunction = getTimingFunction(curve: curve) diff --git a/SpringApp.xcodeproj/project.pbxproj b/SpringApp.xcodeproj/project.pbxproj index 69ef340..bf9efd0 100644 --- a/SpringApp.xcodeproj/project.pbxproj +++ b/SpringApp.xcodeproj/project.pbxproj @@ -408,7 +408,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0830; ORGANIZATIONNAME = "Meng To"; TargetAttributes = { 1A4FDA321A6E44780099D309 = { @@ -598,6 +598,7 @@ 1A4FDA4D1A6E44780099D309 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -624,6 +625,7 @@ 1A4FDA4E1A6E44780099D309 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -688,8 +690,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -732,8 +736,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; diff --git a/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme b/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme index 3748fca..39102c6 100644 --- a/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme +++ b/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme @@ -1,6 +1,6 @@ Date: Fri, 16 Jun 2017 14:14:36 -0400 Subject: [PATCH 02/20] Swift 4 --- Spring/DesignableLabel.swift | 4 +- Spring/DesignableTabBarController.swift | 6 +-- Spring/DesignableTextField.swift | 6 +-- Spring/DesignableTextView.swift | 4 +- Spring/KeyboardLayoutConstraint.swift | 4 +- Spring/Misc.swift | 5 +- Spring/Spring.swift | 2 +- SpringApp.xcodeproj/project.pbxproj | 48 ++++++++++++++----- .../xcshareddata/xcschemes/Spring.xcscheme | 2 +- .../xcshareddata/xcschemes/SpringApp.xcscheme | 2 +- SpringApp/CodeViewController.swift | 2 + SpringApp/SpringViewController.swift | 4 +- 12 files changed, 57 insertions(+), 32 deletions(-) diff --git a/Spring/DesignableLabel.swift b/Spring/DesignableLabel.swift index 146174b..c232f69 100644 --- a/Spring/DesignableLabel.swift +++ b/Spring/DesignableLabel.swift @@ -33,8 +33,8 @@ import UIKit paragraphStyle.lineSpacing = lineHeight let attributedString = NSMutableAttributedString(string: text!) - attributedString.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSMakeRange(0, attributedString.length)) - attributedString.addAttribute(NSFontAttributeName, value: font!, range: NSMakeRange(0, attributedString.length)) + attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attributedString.length)) + attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSMakeRange(0, attributedString.length)) self.attributedText = attributedString } diff --git a/Spring/DesignableTabBarController.swift b/Spring/DesignableTabBarController.swift index 4e55cfc..0857e87 100644 --- a/Spring/DesignableTabBarController.swift +++ b/Spring/DesignableTabBarController.swift @@ -27,20 +27,20 @@ import UIKit @IBInspectable var normalTint: UIColor = UIColor.clear { didSet { UITabBar.appearance().tintColor = normalTint - UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: normalTint], for: UIControlState()) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor.rawValue: normalTint], for: UIControlState()) } } @IBInspectable var selectedTint: UIColor = UIColor.clear { didSet { UITabBar.appearance().tintColor = selectedTint - UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: selectedTint], for:UIControlState.selected) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor.rawValue: selectedTint], for:UIControlState.selected) } } @IBInspectable var fontName: String = "" { didSet { - UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: normalTint, NSFontAttributeName: UIFont(name: fontName, size: 11)!], for: UIControlState()) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor.rawValue: normalTint, NSAttributedStringKey.font.rawValue: UIFont(name: fontName, size: 11)!], for: UIControlState()) } } diff --git a/Spring/DesignableTextField.swift b/Spring/DesignableTextField.swift index ecaf442..8be2717 100644 --- a/Spring/DesignableTextField.swift +++ b/Spring/DesignableTextField.swift @@ -26,7 +26,7 @@ import UIKit @IBInspectable public var placeholderColor: UIColor = UIColor.clear { didSet { - attributedPlaceholder = NSAttributedString(string: placeholder!, attributes: [NSForegroundColorAttributeName: placeholderColor]) + attributedPlaceholder = NSAttributedString(string: placeholder!, attributes: [NSAttributedStringKey.foregroundColor: placeholderColor]) layoutSubviews() } @@ -89,8 +89,8 @@ import UIKit paragraphStyle.lineSpacing = lineHeight let attributedString = NSMutableAttributedString(string: text!) - attributedString.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) - attributedString.addAttribute(NSFontAttributeName, value: font!, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) self.attributedText = attributedString } diff --git a/Spring/DesignableTextView.swift b/Spring/DesignableTextView.swift index 5a74fe1..e716b96 100644 --- a/Spring/DesignableTextView.swift +++ b/Spring/DesignableTextView.swift @@ -51,8 +51,8 @@ import UIKit paragraphStyle.lineSpacing = lineHeight let attributedString = NSMutableAttributedString(string: text!) - attributedString.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) - attributedString.addAttribute(NSFontAttributeName, value: font!, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) self.attributedText = attributedString } diff --git a/Spring/KeyboardLayoutConstraint.swift b/Spring/KeyboardLayoutConstraint.swift index 57ef6f8..79dc8cb 100644 --- a/Spring/KeyboardLayoutConstraint.swift +++ b/Spring/KeyboardLayoutConstraint.swift @@ -42,7 +42,7 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { // MARK: Notification - func keyboardWillShowNotification(_ notification: Notification) { + @objc func keyboardWillShowNotification(_ notification: Notification) { if let userInfo = notification.userInfo { if let frameValue = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue { let frame = frameValue.cgRectValue @@ -73,7 +73,7 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { } - func keyboardWillHideNotification(_ notification: NSNotification) { + @objc func keyboardWillHideNotification(_ notification: NSNotification) { keyboardVisibleHeight = 0 self.updateConstant() diff --git a/Spring/Misc.swift b/Spring/Misc.swift index b6af7d5..2a80c01 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -31,10 +31,11 @@ public extension String { } public func htmlToAttributedString(text: String) -> NSAttributedString! { - let htmlData = text.data(using: String.Encoding.utf8, allowLossyConversion: false) + guard let htmlData = text.data(using: String.Encoding.utf8, allowLossyConversion: false) else { + return NSAttributedString() } let htmlString: NSAttributedString? do { - htmlString = try NSAttributedString(data: htmlData!, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil) + htmlString = try NSAttributedString(data: htmlData, options: [NSAttributedString.DocumentReadingOptionKey.documentType:NSAttributedString.DocumentType.html], documentAttributes: nil) } catch _ { htmlString = nil } diff --git a/Spring/Spring.swift b/Spring/Spring.swift index a6ffff0..5b60b1b 100644 --- a/Spring/Spring.swift +++ b/Spring/Spring.swift @@ -68,7 +68,7 @@ public class Spring : NSObject { NotificationCenter.default.addObserver(self, selector: #selector(Spring.didBecomeActiveNotification(_:)), name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil) } - func didBecomeActiveNotification(_ notification: NSNotification) { + @objc func didBecomeActiveNotification(_ notification: NSNotification) { if shouldAnimateAfterActive { alpha = 0 animate() diff --git a/SpringApp.xcodeproj/project.pbxproj b/SpringApp.xcodeproj/project.pbxproj index bf9efd0..008a95a 100644 --- a/SpringApp.xcodeproj/project.pbxproj +++ b/SpringApp.xcodeproj/project.pbxproj @@ -408,25 +408,25 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0830; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Meng To"; TargetAttributes = { 1A4FDA321A6E44780099D309 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; 1A4FDA3C1A6E44780099D309 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; TestTargetID = 9641173A1A5BE90A000E3A5A; }; 9641173A1A5BE90A000E3A5A = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; 9641174F1A5BE90A000E3A5A = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; TestTargetID = 9641173A1A5BE90A000E3A5A; }; }; @@ -615,7 +615,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -639,7 +640,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -658,7 +660,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jamztang.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Debug; @@ -672,7 +675,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.jamztang.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Release; @@ -685,14 +689,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -720,6 +730,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; }; name = Debug; }; @@ -731,14 +742,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -757,6 +774,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; VALIDATE_PRODUCT = YES; }; name = Release; @@ -770,7 +788,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -785,7 +804,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -802,7 +822,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Debug; @@ -816,7 +837,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Release; diff --git a/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme b/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme index 39102c6..ecfaae8 100644 --- a/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme +++ b/SpringApp.xcodeproj/xcshareddata/xcschemes/Spring.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 19 Jun 2017 11:37:17 -0400 Subject: [PATCH 03/20] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cd07e95..278fa38 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ -![](https://dl.dropboxusercontent.com/u/7990919/Crawler/SpringSwift3.jpg) - -## Updated for Swift 3.0 -Requires Xcode 8 and Swift 3. +## Updated for Swift 4 +Requires Xcode 9 and Swift 4. ## Installation Drop in the Spring folder to your Xcode project (make sure to enable "Copy items if needed" and "Create groups"). From 4bc88153e711f77d1a543bac6abdbc064e304692 Mon Sep 17 00:00:00 2001 From: JPwharton Date: Wed, 28 Jun 2017 09:35:37 -0400 Subject: [PATCH 04/20] Quick fix to placeHolder crash, removal of bang operator. --- Spring/DesignableTextField.swift | 7 ++++--- Spring/DesignableTextView.swift | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Spring/DesignableTextField.swift b/Spring/DesignableTextField.swift index 8be2717..edc5a2b 100644 --- a/Spring/DesignableTextField.swift +++ b/Spring/DesignableTextField.swift @@ -26,7 +26,8 @@ import UIKit @IBInspectable public var placeholderColor: UIColor = UIColor.clear { didSet { - attributedPlaceholder = NSAttributedString(string: placeholder!, attributes: [NSAttributedStringKey.foregroundColor: placeholderColor]) + guard let placeholder = placeholder else { return } + attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [NSAttributedStringKey.foregroundColor: placeholderColor]) layoutSubviews() } @@ -83,12 +84,12 @@ import UIKit @IBInspectable public var lineHeight: CGFloat = 1.5 { didSet { let font = UIFont(name: self.font!.fontName, size: self.font!.pointSize) - let text = self.text + guard let text = self.text else { return } let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = lineHeight - let attributedString = NSMutableAttributedString(string: text!) + let attributedString = NSMutableAttributedString(string: text) attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) diff --git a/Spring/DesignableTextView.swift b/Spring/DesignableTextView.swift index e716b96..3db40b3 100644 --- a/Spring/DesignableTextView.swift +++ b/Spring/DesignableTextView.swift @@ -45,12 +45,12 @@ import UIKit @IBInspectable public var lineHeight: CGFloat = 1.5 { didSet { let font = UIFont(name: self.font!.fontName, size: self.font!.pointSize) - let text = self.text + guard let text = self.text else { return } let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = lineHeight - let attributedString = NSMutableAttributedString(string: text!) + let attributedString = NSMutableAttributedString(string: text) attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) From 57e4b4fe97bc7a9010d30c03adaefea730f9989a Mon Sep 17 00:00:00 2001 From: JPwharton Date: Wed, 28 Jun 2017 09:44:05 -0400 Subject: [PATCH 05/20] Additional force unwrap fixes --- Spring/DesignableLabel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Spring/DesignableLabel.swift b/Spring/DesignableLabel.swift index c232f69..0520d77 100644 --- a/Spring/DesignableLabel.swift +++ b/Spring/DesignableLabel.swift @@ -27,12 +27,12 @@ import UIKit @IBInspectable public var lineHeight: CGFloat = 1.5 { didSet { let font = UIFont(name: self.font.fontName, size: self.font.pointSize) - let text = self.text + guard let text = self.text else { return } let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = lineHeight - let attributedString = NSMutableAttributedString(string: text!) + let attributedString = NSMutableAttributedString(string: text) attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attributedString.length)) attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSMakeRange(0, attributedString.length)) From 386804a3beabe27830ce506f44058c878c591622 Mon Sep 17 00:00:00 2001 From: Jonathan Pacheco Date: Sun, 2 Jul 2017 17:35:03 -0500 Subject: [PATCH 06/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 278fa38..8c84806 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Drop in the Spring folder to your Xcode project (make sure to enable "Copy items Or via CocoaPods: ``` use_frameworks! -pod 'Spring', :git => 'https://github.com/MengTo/Spring.git', :branch => 'swift3' +pod 'Spring', :git => 'https://github.com/MengTo/Spring.git', :branch => 'swift4' ``` ## Usage with Storyboard From fa94a8743211fb8c2dc9171ad6672095175ef405 Mon Sep 17 00:00:00 2001 From: Jake Manning Date: Tue, 11 Jul 2017 18:07:46 -0700 Subject: [PATCH 07/20] Update SoundPlayer.swift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #217 details this problem. It isn’t possible to use SoundPlayer unless these are public --- Spring/SoundPlayer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Spring/SoundPlayer.swift b/Spring/SoundPlayer.swift index 122ba42..d2451d9 100644 --- a/Spring/SoundPlayer.swift +++ b/Spring/SoundPlayer.swift @@ -23,7 +23,7 @@ import UIKit import AudioToolbox -struct SoundPlayer { +public struct SoundPlayer { static var filename : String? static var enabled : Bool = true @@ -32,7 +32,7 @@ struct SoundPlayer { static var cache = [URL:SystemSoundID]() } - static func playSound(soundFile: String) { + public static func playSound(soundFile: String) { if !enabled { return From 94b2f06c10a006805d7b797c01674ad73556c37e Mon Sep 17 00:00:00 2001 From: thedoritos Date: Tue, 1 Aug 2017 10:57:11 +0900 Subject: [PATCH 08/20] Fix compile error --- Spring/DesignableTabBarController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Spring/DesignableTabBarController.swift b/Spring/DesignableTabBarController.swift index 0857e87..dc55036 100644 --- a/Spring/DesignableTabBarController.swift +++ b/Spring/DesignableTabBarController.swift @@ -27,20 +27,20 @@ import UIKit @IBInspectable var normalTint: UIColor = UIColor.clear { didSet { UITabBar.appearance().tintColor = normalTint - UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor.rawValue: normalTint], for: UIControlState()) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: normalTint], for: UIControlState()) } } @IBInspectable var selectedTint: UIColor = UIColor.clear { didSet { UITabBar.appearance().tintColor = selectedTint - UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor.rawValue: selectedTint], for:UIControlState.selected) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: selectedTint], for:UIControlState.selected) } } @IBInspectable var fontName: String = "" { didSet { - UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor.rawValue: normalTint, NSAttributedStringKey.font.rawValue: UIFont(name: fontName, size: 11)!], for: UIControlState()) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: normalTint, NSAttributedStringKey.font: UIFont(name: fontName, size: 11)!], for: UIControlState()) } } From ed10baac4fecd152882a2d301b45a2769c1240c7 Mon Sep 17 00:00:00 2001 From: Hamza Ansari Date: Fri, 20 Oct 2017 14:16:21 +0530 Subject: [PATCH 09/20] Substring deprecated fix --- Spring/Misc.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spring/Misc.swift b/Spring/Misc.swift index 2a80c01..b2a27ce 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -67,7 +67,7 @@ public extension UIColor { if hex.hasPrefix("#") { let index = hex.index(hex.startIndex, offsetBy: 1) - hex = hex.substring(from: index) + hex = String(hex[index...]) } let scanner = Scanner(string: hex) From 803a87ed53c942e5dfb1af8b77e3e68850d742d9 Mon Sep 17 00:00:00 2001 From: Tony Mann Date: Sun, 8 Jan 2017 14:41:45 -0800 Subject: [PATCH 10/20] Fix repeat count in the swing animation --- Spring/Spring.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Spring/Spring.swift b/Spring/Spring.swift index 5b60b1b..a563044 100644 --- a/Spring/Spring.swift +++ b/Spring/Spring.swift @@ -358,6 +358,7 @@ public class Spring : NSObject { animation.keyTimes = [0, 0.2, 0.4, 0.6, 0.8, 1] animation.duration = CFTimeInterval(duration) animation.isAdditive = true + animation.repeatCount = repeatCount animation.beginTime = CACurrentMediaTime() + CFTimeInterval(delay) layer.add(animation, forKey: "swing") } From 18b1dbc8a8b346b179413c77fa96f5cb0f78624f Mon Sep 17 00:00:00 2001 From: phatmann Date: Tue, 31 Oct 2017 22:22:06 -0700 Subject: [PATCH 11/20] Use master branch for pod --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c84806..0209267 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Drop in the Spring folder to your Xcode project (make sure to enable "Copy items Or via CocoaPods: ``` use_frameworks! -pod 'Spring', :git => 'https://github.com/MengTo/Spring.git', :branch => 'swift4' +pod 'Spring', :git => 'https://github.com/MengTo/Spring.git' ``` ## Usage with Storyboard From df1ecb65322254f36430c02b632e4724d9cdf720 Mon Sep 17 00:00:00 2001 From: Iori Kanno Date: Wed, 15 Nov 2017 03:11:07 +0900 Subject: [PATCH 12/20] Fix repeat count in the flip animation --- Spring/Spring.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Spring/Spring.swift b/Spring/Spring.swift index a563044..ed2808b 100644 --- a/Spring/Spring.swift +++ b/Spring/Spring.swift @@ -264,6 +264,7 @@ public class Spring : NSObject { animation.toValue = NSValue(caTransform3D: CATransform3DConcat(perspective, CATransform3DMakeRotation(CGFloat(CGFloat.pi), 0, 1, 0))) animation.duration = CFTimeInterval(duration) + animation.repeatCount = repeatCount animation.beginTime = CACurrentMediaTime() + CFTimeInterval(delay) animation.timingFunction = getTimingFunction(curve: curve) layer.add(animation, forKey: "3d") @@ -278,6 +279,7 @@ public class Spring : NSObject { animation.toValue = NSValue(caTransform3D: CATransform3DConcat(perspective,CATransform3DMakeRotation(CGFloat(CGFloat.pi), 1, 0, 0))) animation.duration = CFTimeInterval(duration) + animation.repeatCount = repeatCount animation.beginTime = CACurrentMediaTime() + CFTimeInterval(delay) animation.timingFunction = getTimingFunction(curve: curve) layer.add(animation, forKey: "3d") From be6285482de439bf768f6ebf20c8899aa0c5a57c Mon Sep 17 00:00:00 2001 From: Meng To Date: Wed, 20 Dec 2017 15:20:28 -0500 Subject: [PATCH 13/20] cocoapods 1.0.4 with Swift 4 --- .swift-version | 1 + Spring.podspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .swift-version diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +4 diff --git a/Spring.podspec b/Spring.podspec index a381019..cf59266 100644 --- a/Spring.podspec +++ b/Spring.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Spring' - s.version = '1.0.3' + s.version = '1.0.4' s.license = 'MIT' s.summary = 'A library to simplify iOS animations in Swift.' s.homepage = 'https://github.com/MengTo/Spring' From 19b04d730d3edabbb02a39e58121d1d3220690ee Mon Sep 17 00:00:00 2001 From: Meng To Date: Wed, 20 Dec 2017 15:21:26 -0500 Subject: [PATCH 14/20] Podspec 1.0.5 Swift 4 --- Spring.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spring.podspec b/Spring.podspec index cf59266..6176a50 100644 --- a/Spring.podspec +++ b/Spring.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Spring' - s.version = '1.0.4' + s.version = '1.0.5' s.license = 'MIT' s.summary = 'A library to simplify iOS animations in Swift.' s.homepage = 'https://github.com/MengTo/Spring' From 9a9148948446786caf12ae0158d15116a3229ed0 Mon Sep 17 00:00:00 2001 From: Larry Aasen Date: Sun, 31 Dec 2017 10:23:58 -0500 Subject: [PATCH 15/20] Added support for tvOS. Updated podspec file for tvOS. Eliminated class KeyboardLayoutConstraint on tvOS. Eliminated class LoadingView on tvOS. --- Spring.podspec | 4 +++- Spring/KeyboardLayoutConstraint.swift | 4 ++++ Spring/LoadingView.swift | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Spring.podspec b/Spring.podspec index 6176a50..b05c6ee 100644 --- a/Spring.podspec +++ b/Spring.podspec @@ -8,6 +8,8 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/MengTo/Spring.git', :tag => s.version.to_s } s.requires_arc = true s.ios.deployment_target = '8.0' + s.tvos.deployment_target = '11.0' s.source_files = 'Spring/*.swift' - s.resources = ['Spring/*.xib', 'SpringApp/*.xcassets'] + s.ios.resources = ['Spring/*.xib', 'SpringApp/*.xcassets'] + s.tvos.resources = ['SpringApp/*.xcassets'] end diff --git a/Spring/KeyboardLayoutConstraint.swift b/Spring/KeyboardLayoutConstraint.swift index 79dc8cb..7d1cf9c 100644 --- a/Spring/KeyboardLayoutConstraint.swift +++ b/Spring/KeyboardLayoutConstraint.swift @@ -22,11 +22,14 @@ import UIKit +#if !os(tvOS) +@available(tvOS, unavailable) public class KeyboardLayoutConstraint: NSLayoutConstraint { private var offset : CGFloat = 0 private var keyboardVisibleHeight : CGFloat = 0 + @available(tvOS, unavailable) override public func awakeFromNib() { super.awakeFromNib() @@ -104,3 +107,4 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { } } +#endif diff --git a/Spring/LoadingView.swift b/Spring/LoadingView.swift index 047aaa9..5f62ce8 100644 --- a/Spring/LoadingView.swift +++ b/Spring/LoadingView.swift @@ -22,6 +22,8 @@ import UIKit +#if !os(tvOS) +@available(tvOS, unavailable) public class LoadingView: UIView { @IBOutlet public weak var indicatorView: SpringView! @@ -81,3 +83,4 @@ public extension UIView { } } +#endif From dc55d6dfc8a4bb4fbe3fd683644d363deb4ad749 Mon Sep 17 00:00:00 2001 From: Juan Carbonell Date: Fri, 21 Sep 2018 11:07:05 +0200 Subject: [PATCH 16/20] FIX Updated for Xcode 10 and Swift 4.2 --- Spring/AsyncButton.swift | 2 +- Spring/BlurView.swift | 2 +- Spring/DesignableLabel.swift | 4 ++-- Spring/DesignableTabBarController.swift | 18 ++++++++-------- Spring/DesignableTextField.swift | 14 ++++++------- Spring/DesignableTextView.swift | 10 ++++----- Spring/KeyboardLayoutConstraint.swift | 14 ++++++------- Spring/Misc.swift | 4 ++-- Spring/Spring.swift | 28 ++++++++++++------------- Spring/SpringAnimation.swift | 2 +- SpringApp.xcodeproj/project.pbxproj | 8 +++---- 11 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Spring/AsyncButton.swift b/Spring/AsyncButton.swift index 7d9f2db..6e03ac9 100644 --- a/Spring/AsyncButton.swift +++ b/Spring/AsyncButton.swift @@ -28,7 +28,7 @@ public class AsyncButton: UIButton { private var placeholderImage = [UInt:UIImage]() - public func setImageURL(url: NSURL?, placeholderImage placeholder:UIImage?, forState state:UIControlState) { + public func setImageURL(url: NSURL?, placeholderImage placeholder:UIImage?, forState state:UIControl.State) { imageURL[state.rawValue] = url placeholderImage[state.rawValue] = placeholder diff --git a/Spring/BlurView.swift b/Spring/BlurView.swift index 2defcf6..8de1611 100644 --- a/Spring/BlurView.swift +++ b/Spring/BlurView.swift @@ -22,7 +22,7 @@ import UIKit -public func insertBlurView (view: UIView, style: UIBlurEffectStyle) -> UIVisualEffectView { +public func insertBlurView (view: UIView, style: UIBlurEffect.Style) -> UIVisualEffectView { view.backgroundColor = UIColor.clear let blurEffect = UIBlurEffect(style: style) diff --git a/Spring/DesignableLabel.swift b/Spring/DesignableLabel.swift index 0520d77..8d6994b 100644 --- a/Spring/DesignableLabel.swift +++ b/Spring/DesignableLabel.swift @@ -33,8 +33,8 @@ import UIKit paragraphStyle.lineSpacing = lineHeight let attributedString = NSMutableAttributedString(string: text) - attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attributedString.length)) - attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSMakeRange(0, attributedString.length)) + attributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attributedString.length)) + attributedString.addAttribute(NSAttributedString.Key.font, value: font!, range: NSMakeRange(0, attributedString.length)) self.attributedText = attributedString } diff --git a/Spring/DesignableTabBarController.swift b/Spring/DesignableTabBarController.swift index dc55036..f75fbcc 100644 --- a/Spring/DesignableTabBarController.swift +++ b/Spring/DesignableTabBarController.swift @@ -27,20 +27,20 @@ import UIKit @IBInspectable var normalTint: UIColor = UIColor.clear { didSet { UITabBar.appearance().tintColor = normalTint - UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: normalTint], for: UIControlState()) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: normalTint], for: UIControl.State()) } } @IBInspectable var selectedTint: UIColor = UIColor.clear { didSet { UITabBar.appearance().tintColor = selectedTint - UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: selectedTint], for:UIControlState.selected) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: selectedTint], for:UIControl.State.selected) } } @IBInspectable var fontName: String = "" { didSet { - UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: normalTint, NSAttributedStringKey.font: UIFont(name: fontName, size: 11)!], for: UIControlState()) + UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: normalTint, NSAttributedString.Key.font: UIFont(name: fontName, size: 11)!], for: UIControl.State()) } } @@ -48,7 +48,7 @@ import UIKit didSet { if let image = firstSelectedImage { var tabBarItems = self.tabBar.items as [UITabBarItem]! - tabBarItems?[0].selectedImage = image.withRenderingMode(UIImageRenderingMode.alwaysTemplate) + tabBarItems?[0].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } } @@ -57,7 +57,7 @@ import UIKit didSet { if let image = secondSelectedImage { var tabBarItems = self.tabBar.items as [UITabBarItem]! - tabBarItems?[1].selectedImage = image.withRenderingMode(UIImageRenderingMode.alwaysTemplate) + tabBarItems?[1].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } } @@ -66,7 +66,7 @@ import UIKit didSet { if let image = thirdSelectedImage { var tabBarItems = self.tabBar.items as [UITabBarItem]! - tabBarItems?[2].selectedImage = image.withRenderingMode(UIImageRenderingMode.alwaysTemplate) + tabBarItems?[2].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } } @@ -75,7 +75,7 @@ import UIKit didSet { if let image = fourthSelectedImage { var tabBarItems = self.tabBar.items as [UITabBarItem]! - tabBarItems?[3].selectedImage = image.withRenderingMode(UIImageRenderingMode.alwaysTemplate) + tabBarItems?[3].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } } @@ -84,7 +84,7 @@ import UIKit didSet { if let image = fifthSelectedImage { var tabBarItems = self.tabBar.items as [UITabBarItem]! - tabBarItems?[4].selectedImage = image.withRenderingMode(UIImageRenderingMode.alwaysTemplate) + tabBarItems?[4].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } } @@ -94,7 +94,7 @@ import UIKit for item in self.tabBar.items as [UITabBarItem]! { if let image = item.image { - item.image = image.imageWithColor(tintColor: self.normalTint).withRenderingMode(UIImageRenderingMode.alwaysOriginal) + item.image = image.imageWithColor(tintColor: self.normalTint).withRenderingMode(UIImage.RenderingMode.alwaysOriginal) } } } diff --git a/Spring/DesignableTextField.swift b/Spring/DesignableTextField.swift index edc5a2b..e334a8e 100644 --- a/Spring/DesignableTextField.swift +++ b/Spring/DesignableTextField.swift @@ -27,7 +27,7 @@ import UIKit @IBInspectable public var placeholderColor: UIColor = UIColor.clear { didSet { guard let placeholder = placeholder else { return } - attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [NSAttributedStringKey.foregroundColor: placeholderColor]) + attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [NSAttributedString.Key.foregroundColor: placeholderColor]) layoutSubviews() } @@ -37,10 +37,10 @@ import UIKit didSet { let padding = UIView(frame: CGRect(x: 0, y: 0, width: sidePadding, height: sidePadding)) - leftViewMode = UITextFieldViewMode.always + leftViewMode = UITextField.ViewMode.always leftView = padding - rightViewMode = UITextFieldViewMode.always + rightViewMode = UITextField.ViewMode.always rightView = padding } } @@ -49,7 +49,7 @@ import UIKit didSet { let padding = UIView(frame: CGRect(x: 0, y: 0, width: leftPadding, height: 0)) - leftViewMode = UITextFieldViewMode.always + leftViewMode = UITextField.ViewMode.always leftView = padding } } @@ -58,7 +58,7 @@ import UIKit didSet { let padding = UIView(frame: CGRect(x: 0, y: 0, width: rightPadding, height: 0)) - rightViewMode = UITextFieldViewMode.always + rightViewMode = UITextField.ViewMode.always rightView = padding } } @@ -90,8 +90,8 @@ import UIKit paragraphStyle.lineSpacing = lineHeight let attributedString = NSMutableAttributedString(string: text) - attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) - attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedString.Key.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) self.attributedText = attributedString } diff --git a/Spring/DesignableTextView.swift b/Spring/DesignableTextView.swift index 3db40b3..779298a 100644 --- a/Spring/DesignableTextView.swift +++ b/Spring/DesignableTextView.swift @@ -41,7 +41,7 @@ import UIKit layer.cornerRadius = cornerRadius } } - + @IBInspectable public var lineHeight: CGFloat = 1.5 { didSet { let font = UIFont(name: self.font!.fontName, size: self.font!.pointSize) @@ -49,13 +49,13 @@ import UIKit let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = lineHeight - + let attributedString = NSMutableAttributedString(string: text) - attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) - attributedString.addAttribute(NSAttributedStringKey.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + attributedString.addAttribute(NSAttributedString.Key.font, value: font!, range: NSRange(location: 0, length: attributedString.length)) self.attributedText = attributedString } } - + } diff --git a/Spring/KeyboardLayoutConstraint.swift b/Spring/KeyboardLayoutConstraint.swift index 7d1cf9c..1b45a56 100644 --- a/Spring/KeyboardLayoutConstraint.swift +++ b/Spring/KeyboardLayoutConstraint.swift @@ -35,8 +35,8 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { offset = constant - NotificationCenter.default.addObserver(self, selector: #selector(KeyboardLayoutConstraint.keyboardWillShowNotification(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(KeyboardLayoutConstraint.keyboardWillHideNotification(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(KeyboardLayoutConstraint.keyboardWillShowNotification(_:)), name: UIWindow.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(KeyboardLayoutConstraint.keyboardWillHideNotification(_:)), name: UIWindow.keyboardWillHideNotification, object: nil) } deinit { @@ -47,16 +47,16 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { @objc func keyboardWillShowNotification(_ notification: Notification) { if let userInfo = notification.userInfo { - if let frameValue = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue { + if let frameValue = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { let frame = frameValue.cgRectValue keyboardVisibleHeight = frame.size.height } self.updateConstant() - switch (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber, userInfo[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber) { + switch (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber, userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? NSNumber) { case let (.some(duration), .some(curve)): - let options = UIViewAnimationOptions(rawValue: curve.uintValue) + let options = UIView.AnimationOptions(rawValue: curve.uintValue) UIView.animate( withDuration: TimeInterval(duration.doubleValue), @@ -82,10 +82,10 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { if let userInfo = notification.userInfo { - switch (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber, userInfo[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber) { + switch (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber, userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? NSNumber) { case let (.some(duration), .some(curve)): - let options = UIViewAnimationOptions(rawValue: curve.uintValue) + let options = UIView.AnimationOptions(rawValue: curve.uintValue) UIView.animate( withDuration: TimeInterval(duration.doubleValue), diff --git a/Spring/Misc.swift b/Spring/Misc.swift index b2a27ce..c0a9add 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -235,7 +235,7 @@ public func timeAgoSinceDate(date: Date, numericDates: Bool) -> String { } extension UIImageView { - func setImage(url: URL, contentMode mode: UIViewContentMode = .scaleAspectFit, placeholderImage: UIImage?) { + func setImage(url: URL, contentMode mode: UIView.ContentMode = .scaleAspectFit, placeholderImage: UIImage?) { contentMode = mode URLSession.shared.dataTask(with: url) { (data, response, error) in guard @@ -253,7 +253,7 @@ extension UIImageView { } }.resume() } - func setImage(urlString: String, contentMode mode: UIViewContentMode = .scaleAspectFit, placeholderImage: UIImage?) { + func setImage(urlString: String, contentMode mode: UIView.ContentMode = .scaleAspectFit, placeholderImage: UIImage?) { guard let url = URL(string: urlString) else { image = placeholderImage return diff --git a/Spring/Spring.swift b/Spring/Spring.swift index ed2808b..cf86e1a 100644 --- a/Spring/Spring.swift +++ b/Spring/Spring.swift @@ -65,7 +65,7 @@ public class Spring : NSObject { } func commonInit() { - NotificationCenter.default.addObserver(self, selector: #selector(Spring.didBecomeActiveNotification(_:)), name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(Spring.didBecomeActiveNotification(_:)), name: UIApplication.didBecomeActiveNotification, object: nil) } @objc func didBecomeActiveNotification(_ notification: NSNotification) { @@ -77,7 +77,7 @@ public class Spring : NSObject { } deinit { - NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil) + NotificationCenter.default.removeObserver(self, name: UIApplication.didBecomeActiveNotification, object: nil) } private var autostart: Bool { set { self.view.autostart = newValue } get { return self.view.autostart }} @@ -370,10 +370,10 @@ public class Spring : NSObject { func getTimingFunction(curve: String) -> CAMediaTimingFunction { if let curve = AnimationCurve(rawValue: curve) { switch curve { - case .EaseIn: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) - case .EaseOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) - case .EaseInOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) - case .Linear: return CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + case .EaseIn: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn) + case .EaseOut: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut) + case .EaseInOut: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) + case .Linear: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) case .Spring: return CAMediaTimingFunction(controlPoints: 0.5, 1.1+Float(force/3), 1, 1) case .EaseInSine: return CAMediaTimingFunction(controlPoints: 0.47, 0, 0.745, 0.715) case .EaseOutSine: return CAMediaTimingFunction(controlPoints: 0.39, 0.575, 0.565, 1) @@ -401,19 +401,19 @@ public class Spring : NSObject { case .EaseInOutBack: return CAMediaTimingFunction(controlPoints: 0.68, -0.55, 0.265, 1.55) } } - return CAMediaTimingFunction(name: kCAMediaTimingFunctionDefault) + return CAMediaTimingFunction(name: CAMediaTimingFunctionName.default) } - func getAnimationOptions(curve: String) -> UIViewAnimationOptions { + func getAnimationOptions(curve: String) -> UIView.AnimationOptions { if let curve = AnimationCurve(rawValue: curve) { switch curve { - case .EaseIn: return UIViewAnimationOptions.curveEaseIn - case .EaseOut: return UIViewAnimationOptions.curveEaseOut - case .EaseInOut: return UIViewAnimationOptions() + case .EaseIn: return UIView.AnimationOptions.curveEaseIn + case .EaseOut: return UIView.AnimationOptions.curveEaseOut + case .EaseInOut: return UIView.AnimationOptions() default: break } } - return UIViewAnimationOptions.curveLinear + return UIView.AnimationOptions.curveLinear } public func animate() { @@ -479,7 +479,7 @@ public class Spring : NSObject { delay: TimeInterval(delay), usingSpringWithDamping: damping, initialSpringVelocity: velocity, - options: [getAnimationOptions(curve: curve), UIViewAnimationOptions.allowUserInteraction], + options: [getAnimationOptions(curve: curve), UIView.AnimationOptions.allowUserInteraction], animations: { [weak self] in if let _self = self { @@ -504,7 +504,7 @@ public class Spring : NSObject { completion() self?.resetAll() - }) + }) } diff --git a/Spring/SpringAnimation.swift b/Spring/SpringAnimation.swift index e237d3d..998882b 100644 --- a/Spring/SpringAnimation.swift +++ b/Spring/SpringAnimation.swift @@ -64,7 +64,7 @@ import UIKit UIView.animate( withDuration: duration, delay: 0, - options: UIViewAnimationOptions(), + options: UIView.AnimationOptions(), animations: { animations() }, completion: nil diff --git a/SpringApp.xcodeproj/project.pbxproj b/SpringApp.xcodeproj/project.pbxproj index 008a95a..8e701c1 100644 --- a/SpringApp.xcodeproj/project.pbxproj +++ b/SpringApp.xcodeproj/project.pbxproj @@ -616,7 +616,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -641,7 +641,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -789,7 +789,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -805,7 +805,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; From d761f575b0bd593c57718b53125908d9258ddc08 Mon Sep 17 00:00:00 2001 From: Meng To Date: Wed, 3 Oct 2018 11:16:39 -0400 Subject: [PATCH 17/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0209267..49a7fa5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ## Updated for Swift 4 -Requires Xcode 9 and Swift 4. +Requires Xcode 10 and Swift 4.2. ## Installation Drop in the Spring folder to your Xcode project (make sure to enable "Copy items if needed" and "Create groups"). From d507c1244f944dcf675aa46fe024e2b2f40a662c Mon Sep 17 00:00:00 2001 From: Meng To Date: Wed, 3 Oct 2018 11:16:48 -0400 Subject: [PATCH 18/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49a7fa5..34f1430 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Updated for Swift 4 +## Updated for Swift 4.2 Requires Xcode 10 and Swift 4.2. ## Installation From fafd0b2e8d4d46405bd86fa7ba84bb7f73a20b13 Mon Sep 17 00:00:00 2001 From: Meng To Date: Wed, 10 Oct 2018 13:23:42 -0400 Subject: [PATCH 19/20] Update Spring.podspec --- Spring.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spring.podspec b/Spring.podspec index b05c6ee..a43ed30 100644 --- a/Spring.podspec +++ b/Spring.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Spring' - s.version = '1.0.5' + s.version = '1.0.6' s.license = 'MIT' s.summary = 'A library to simplify iOS animations in Swift.' s.homepage = 'https://github.com/MengTo/Spring' From febc1fa3787b19f8dc21c48d5e7bb826ef46bb25 Mon Sep 17 00:00:00 2001 From: nhannlt Date: Fri, 26 Jul 2019 15:29:03 +0700 Subject: [PATCH 20/20] Upgrade to swift 5 --- Spring/DesignableTabBarController.swift | 19 +++++++------- Spring/Misc.swift | 6 ++--- SpringApp.xcodeproj/project.pbxproj | 33 ++++++++++--------------- 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Spring/DesignableTabBarController.swift b/Spring/DesignableTabBarController.swift index f75fbcc..6c81095 100644 --- a/Spring/DesignableTabBarController.swift +++ b/Spring/DesignableTabBarController.swift @@ -47,7 +47,7 @@ import UIKit @IBInspectable var firstSelectedImage: UIImage? { didSet { if let image = firstSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[0].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -56,7 +56,7 @@ import UIKit @IBInspectable var secondSelectedImage: UIImage? { didSet { if let image = secondSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[1].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -65,7 +65,7 @@ import UIKit @IBInspectable var thirdSelectedImage: UIImage? { didSet { if let image = thirdSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[2].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -74,7 +74,7 @@ import UIKit @IBInspectable var fourthSelectedImage: UIImage? { didSet { if let image = fourthSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[3].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -83,7 +83,7 @@ import UIKit @IBInspectable var fifthSelectedImage: UIImage? { didSet { if let image = fifthSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[4].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -91,10 +91,11 @@ import UIKit override func viewDidLoad() { super.viewDidLoad() - - for item in self.tabBar.items as [UITabBarItem]! { - if let image = item.image { - item.image = image.imageWithColor(tintColor: self.normalTint).withRenderingMode(UIImage.RenderingMode.alwaysOriginal) + if let items = self.tabBar.items { + for item in items { + if let image = item.image { + item.image = image.imageWithColor(tintColor: self.normalTint).withRenderingMode(UIImage.RenderingMode.alwaysOriginal) + } } } } diff --git a/Spring/Misc.swift b/Spring/Misc.swift index c0a9add..96024b8 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -23,9 +23,9 @@ import UIKit public extension String { - public var length: Int { return self.characters.count } + var length: Int { return self.count } - public func toURL() -> NSURL? { + func toURL() -> NSURL? { return NSURL(string: self) } } @@ -73,7 +73,7 @@ public extension UIColor { let scanner = Scanner(string: hex) var hexValue: CUnsignedLongLong = 0 if scanner.scanHexInt64(&hexValue) { - switch (hex.characters.count) { + switch (hex.count) { case 3: red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0 diff --git a/SpringApp.xcodeproj/project.pbxproj b/SpringApp.xcodeproj/project.pbxproj index 8e701c1..a0e8956 100644 --- a/SpringApp.xcodeproj/project.pbxproj +++ b/SpringApp.xcodeproj/project.pbxproj @@ -413,20 +413,20 @@ TargetAttributes = { 1A4FDA321A6E44780099D309 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 1A4FDA3C1A6E44780099D309 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; TestTargetID = 9641173A1A5BE90A000E3A5A; }; 9641173A1A5BE90A000E3A5A = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 9641174F1A5BE90A000E3A5A = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; TestTargetID = 9641173A1A5BE90A000E3A5A; }; }; @@ -436,6 +436,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -615,8 +616,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -640,8 +640,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -660,8 +659,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jamztang.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Debug; @@ -675,8 +673,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.jamztang.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Release; @@ -788,8 +785,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -804,8 +800,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -822,8 +817,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Debug; @@ -837,8 +831,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Release;