From 5b9c92ac6c0c47213234a5ec9b50681d1586b261 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 30 Oct 2017 23:11:28 +0800 Subject: [PATCH 1/7] Update Ruby Gems --- .ruby-version | 2 +- Gemfile | 2 +- Gemfile.lock | 50 ++++++++++++++++++++++++++------------------------ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.ruby-version b/.ruby-version index 005119b..8e8299d 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.1 +2.4.2 diff --git a/Gemfile b/Gemfile index cd3112f..0bce4ea 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "http://rubygems.org" gem "cocoapods" gem "danger" -gem "jazzy", "~> 0.8.0" +gem "jazzy", ">= 0.8.0" gem "pry" gem "rake" gem "xcpretty" diff --git a/Gemfile.lock b/Gemfile.lock index d062184..a22be3e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,13 +2,13 @@ GEM remote: http://rubygems.org/ specs: CFPropertyList (2.3.5) - activesupport (4.2.9) + activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) claide (1.0.2) claide-plugins (0.9.2) cork @@ -43,15 +43,16 @@ GEM nap cocoapods-search (1.0.0) cocoapods-stats (1.0.0) - cocoapods-trunk (1.2.0) + cocoapods-trunk (1.3.0) nap (>= 0.8, < 2.0) - netrc (= 0.7.8) + netrc (~> 0.11) cocoapods-try (1.1.0) - coderay (1.1.1) + coderay (1.1.2) colored2 (3.1.2) + concurrent-ruby (1.0.5) cork (0.3.0) colored2 (~> 3.1) - danger (5.3.4) + danger (5.5.3) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -60,10 +61,11 @@ GEM faraday-http-cache (~> 1.0) git (~> 1) kramdown (~> 1.5) + no_proxy_fix octokit (~> 4.7) terminal-table (~> 1) escape (0.0.4) - faraday (0.13.0) + faraday (0.13.1) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) @@ -72,8 +74,9 @@ GEM fuzzy_match (2.0.4) gh_inspector (1.0.3) git (1.3.0) - i18n (0.8.6) - jazzy (0.8.3) + i18n (0.9.0) + concurrent-ruby (~> 1.0) + jazzy (0.9.0) cocoapods (~> 1.0) mustache (~> 0.99) open4 @@ -82,32 +85,32 @@ GEM sass (~> 3.4) sqlite3 (~> 1.3) xcinvoke (~> 0.3.0) - kramdown (1.14.0) + kramdown (1.15.0) liferaft (0.0.6) - method_source (0.8.2) + method_source (0.9.0) minitest (5.10.3) molinillo (0.5.7) multipart-post (2.0.0) mustache (0.99.8) nanaimo (0.2.3) nap (1.1.0) - netrc (0.7.8) + netrc (0.11.0) + no_proxy_fix (0.1.2) octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - pry (0.10.4) + pry (0.11.2) coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (2.0.5) - rake (12.0.0) + method_source (~> 0.9.0) + public_suffix (3.0.0) + rake (12.2.1) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redcarpet (3.4.0) rouge (1.11.1) ruby-macho (1.1.0) - sass (3.5.1) + sass (3.5.3) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -115,17 +118,16 @@ GEM sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - slop (3.6.0) sqlite3 (1.3.13) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) - tzinfo (1.2.3) + tzinfo (1.2.4) thread_safe (~> 0.1) unicode-display_width (1.3.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.5.1) + xcodeproj (1.5.3) CFPropertyList (~> 2.3.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) @@ -139,10 +141,10 @@ PLATFORMS DEPENDENCIES cocoapods danger - jazzy (~> 0.8.0) + jazzy (>= 0.8.0) pry rake xcpretty BUNDLED WITH - 1.15.3 + 1.15.4 From 04aed4cd32e69b47b1a43a0a65d4a2edf3047d63 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 27 Oct 2017 13:26:29 +0800 Subject: [PATCH 2/7] Convert to Swift 4 syntax * Use NSAttributedStringKey in string attributes * Use String slicing subscript with the PartialRangeUpTo operator --- Example/CustomizedTokenField.swift | 16 ++++----- Example/StoryboardViewController.swift | 8 ++--- ICInputAccessory.xcodeproj/project.pbxproj | 17 +++++----- Source/TokenField/ICBackspaceTextField.swift | 2 +- Source/TokenField/ICToken.swift | 35 +++++++++++--------- Source/TokenField/ICTokenField.swift | 12 +++---- 6 files changed, 48 insertions(+), 42 deletions(-) diff --git a/Example/CustomizedTokenField.swift b/Example/CustomizedTokenField.swift index c8c1870..1f2fbeb 100644 --- a/Example/CustomizedTokenField.swift +++ b/Example/CustomizedTokenField.swift @@ -66,21 +66,21 @@ extension ICTokenField { attributedPlaceholder = NSAttributedString( string: String(describing: type(of: self)), attributes: [ - NSForegroundColorAttributeName: UIColor.white.withAlphaComponent(0.5), - NSFontAttributeName: UIFont.boldSystemFont(ofSize: 14) + .foregroundColor: UIColor.white.withAlphaComponent(0.5), + .font: UIFont.boldSystemFont(ofSize: 14) ] ) normalTokenAttributes = [ - NSForegroundColorAttributeName: UIColor.white, - NSBackgroundColorAttributeName: UIColor.white.withAlphaComponent(0.25), - NSFontAttributeName: UIFont.boldSystemFont(ofSize: 14) + .foregroundColor: UIColor.white, + .backgroundColor: UIColor.white.withAlphaComponent(0.25), + .font: UIFont.boldSystemFont(ofSize: 14) ] highlightedTokenAttributes = [ - NSForegroundColorAttributeName: UIColor(red:0.8, green:0.32, blue:0.24, alpha:1), - NSBackgroundColorAttributeName: UIColor.white, - NSFontAttributeName: UIFont.boldSystemFont(ofSize: 14) + .foregroundColor: UIColor(red:0.8, green:0.32, blue:0.24, alpha:1), + .backgroundColor: UIColor.white, + .font: UIFont.boldSystemFont(ofSize: 14) ] } diff --git a/Example/StoryboardViewController.swift b/Example/StoryboardViewController.swift index 955b448..046c832 100644 --- a/Example/StoryboardViewController.swift +++ b/Example/StoryboardViewController.swift @@ -32,13 +32,13 @@ class StoryboardViewController: UITableViewController { @IBOutlet weak var tokenField: ICTokenField! { didSet { tokenField.normalTokenAttributes = [ - NSForegroundColorAttributeName: UIColor.white, - NSBackgroundColorAttributeName: UIColor.white.withAlphaComponent(0.25) + .foregroundColor: UIColor.white, + .backgroundColor: UIColor.white.withAlphaComponent(0.25) ] tokenField.highlightedTokenAttributes = [ - NSForegroundColorAttributeName: UIColor.darkGray, - NSBackgroundColorAttributeName: UIColor.white + .foregroundColor: UIColor.darkGray, + .backgroundColor: UIColor.white ] } } diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index c2bb35d..d6d7067 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -304,17 +304,18 @@ TargetAttributes = { B53376871F4436D000230739 = { CreatedOnToolsVersion = 8.3.3; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; B533769A1F4436D000230739 = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 0830; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; TestTargetID = B53376871F4436D000230739; }; B56BC4291C89A7EA00C20AD6 = { CreatedOnToolsVersion = 7.2.1; - LastSwiftMigration = 0830; + LastSwiftMigration = 0900; }; }; }; @@ -509,7 +510,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessory.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -528,7 +529,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessory.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -549,7 +550,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TEST_TARGET_NAME = Example; }; name = Debug; @@ -570,7 +571,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TEST_TARGET_NAME = Example; }; name = Release; @@ -689,7 +690,7 @@ PRODUCT_NAME = ICInputAccessory; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -710,7 +711,7 @@ PRODUCT_NAME = ICInputAccessory; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Source/TokenField/ICBackspaceTextField.swift b/Source/TokenField/ICBackspaceTextField.swift index a83aa1f..288b590 100644 --- a/Source/TokenField/ICBackspaceTextField.swift +++ b/Source/TokenField/ICBackspaceTextField.swift @@ -56,7 +56,7 @@ class ICBackspaceTextField: UITextField { // MARK: - UITextField - func keyboardInputShouldDelete(_ textField: UITextField) -> Bool { + @objc func keyboardInputShouldDelete(_ textField: UITextField) -> Bool { return backspaceDelegate?.textFieldShouldDelete(self) ?? true } diff --git a/Source/TokenField/ICToken.swift b/Source/TokenField/ICToken.swift index cfae883..6b65a42 100644 --- a/Source/TokenField/ICToken.swift +++ b/Source/TokenField/ICToken.swift @@ -41,19 +41,19 @@ class ICToken: UIView { } } - var normalTextAttributes: [String : NSObject] = [ - NSForegroundColorAttributeName: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1), - NSBackgroundColorAttributeName: UIColor.clear + var normalTextAttributes: [NSAttributedStringKey: NSObject] = [ + .foregroundColor: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1), + .backgroundColor: UIColor.clear ] { didSet { if !isHighlighted { updateTextLabel() } - delimiterLabel.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor + delimiterLabel.textColor = self.normalTextAttributes[.foregroundColor] as? UIColor } } - var highlightedTextAttributes: [String: NSObject] = [ - NSForegroundColorAttributeName: UIColor.white, - NSBackgroundColorAttributeName: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1) + var highlightedTextAttributes: [NSAttributedStringKey: NSObject] = [ + .foregroundColor: UIColor.white, + .backgroundColor: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1) ] { didSet { if isHighlighted { updateTextLabel() } @@ -64,7 +64,7 @@ class ICToken: UIView { private(set) lazy var delimiterLabel: UILabel = { let _label = UILabel() - _label.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor + _label.textColor = self.normalTextAttributes[.foregroundColor] as? UIColor _label.textAlignment = .right return _label }() @@ -72,8 +72,8 @@ class ICToken: UIView { private(set) lazy var textLabel: UILabel = { let _label = ICInsetLabel(contentEdgeInsets: UIEdgeInsets(top: 3, left: 5, bottom: 3, right: 5), cornerRadius: .constant(3)) _label.textAlignment = .center - _label.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor - _label.backgroundColor = self.normalTextAttributes[NSBackgroundColorAttributeName] as? UIColor + _label.textColor = self.normalTextAttributes[.foregroundColor] as? UIColor + _label.backgroundColor = self.normalTextAttributes[.backgroundColor] as? UIColor _label.numberOfLines = 1 return _label }() @@ -90,7 +90,12 @@ class ICToken: UIView { setUpSubviews() } - convenience init(text: String, delimiter: String = ",", normalAttributes: [String: NSObject]? = nil, highlightedAttributes: [String: NSObject]? = nil) { + convenience init( + text: String, + delimiter: String = ",", + normalAttributes: [NSAttributedStringKey: NSObject]? = nil, + highlightedAttributes: [NSAttributedStringKey: NSObject]? = nil + ) { self.init() if let attributes = normalAttributes { normalTextAttributes = attributes } if let attributes = highlightedAttributes { highlightedTextAttributes = attributes } @@ -105,15 +110,15 @@ class ICToken: UIView { private func updateTextLabel() { var attributes = isHighlighted ? highlightedTextAttributes : normalTextAttributes - if let color = attributes[NSBackgroundColorAttributeName] as? UIColor { + if let color = attributes[.backgroundColor] as? UIColor { textLabel.backgroundColor = color } // Avoid overlapped translucent background colors - attributes[NSBackgroundColorAttributeName] = nil + attributes[.backgroundColor] = nil textLabel.attributedText = NSAttributedString(string: text, attributes: attributes) - delimiterLabel.textColor = normalTextAttributes[NSForegroundColorAttributeName] as? UIColor - delimiterLabel.font = normalTextAttributes[NSFontAttributeName] as? UIFont + delimiterLabel.textColor = normalTextAttributes[.foregroundColor] as? UIColor + delimiterLabel.font = normalTextAttributes[.font] as? UIFont } private func setUpSubviews() { diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 989cb29..006ef5a 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -92,7 +92,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega if let text = newValue { attributedPlaceholder = NSAttributedString( string: text, - attributes: [NSForegroundColorAttributeName: UIColor(red: 0.78, green: 0.78, blue: 0.80, alpha: 0.9)] + attributes: [.foregroundColor: UIColor(red: 0.78, green: 0.78, blue: 0.80, alpha: 0.9)] ) } else { attributedPlaceholder = nil @@ -114,7 +114,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega if placeholderLabel.superview != nil { return } insertSubview(placeholderLabel, belowSubview: scrollView) placeholderLabel.translatesAutoresizingMaskIntoConstraints = false - placeholderLabel.setContentHuggingPriority(UILayoutPriorityDefaultLow - 1, for: .horizontal) + placeholderLabel.setContentHuggingPriority(UILayoutPriority(rawValue: UILayoutPriority.RawValue(Int(UILayoutPriority.defaultLow.rawValue) - 1)), for: .horizontal) addConstraint(NSLayoutConstraint(item: placeholderLabel, attribute: .leading, relatedBy: .equal, toItem: scrollView, attribute: .leading, multiplier: 1, constant: 0)) addConstraint(NSLayoutConstraint(item: placeholderLabel, attribute: .trailing, relatedBy: .greaterThanOrEqual, toItem: scrollView, attribute: .trailing, multiplier: 1, constant: 10)) addConstraint(NSLayoutConstraint(item: placeholderLabel, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: 0)) @@ -122,14 +122,14 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega } /// Customized attributes for tokens in the normal state, e.g. `NSFontAttributeName` and `NSForegroundColorAttributeName`. - public var normalTokenAttributes: [String: NSObject]? { + public var normalTokenAttributes: [NSAttributedStringKey: NSObject]? { didSet { tokens.forEach { $0.normalTextAttributes = normalTokenAttributes ?? [:] } } } /// Customized attributes for tokens in the highlighted state. - public var highlightedTokenAttributes: [String: NSObject]? { + public var highlightedTokenAttributes: [NSAttributedStringKey: NSObject]? { didSet { tokens.forEach { $0.highlightedTextAttributes = normalTokenAttributes ?? [:] } } @@ -301,7 +301,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega } let index = text.index(text.endIndex, offsetBy: -delimiter.characters.count) - let newText = text.substring(to: index) + let newText = String(text[.. Date: Fri, 27 Oct 2017 13:31:22 +0800 Subject: [PATCH 3/7] Update to Xcode 9 recommended settings --- ICInputAccessory.xcodeproj/project.pbxproj | 14 +++++++++++++- .../xcshareddata/xcschemes/Example.xcscheme | 4 +++- .../xcschemes/ICInputAccessory-iOS.xcscheme | 4 +++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index d6d7067..30b007b 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -299,7 +299,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Polydice, Inc."; TargetAttributes = { B53376871F4436D000230739 = { @@ -585,14 +585,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; @@ -637,14 +643,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; diff --git a/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index 625ada2..34be65e 100644 --- a/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" From 3b9473adc98bd1eba2e93edbfe15f529540bd52a Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 27 Oct 2017 16:20:25 +0800 Subject: [PATCH 4/7] Use Xcode 9 on Travis CI --- .swift-version | 2 +- .travis.yml | 4 ++-- CHANGELOG.md | 4 ++++ ICInputAccessory.xcodeproj/project.pbxproj | 4 ++-- README.md | 3 ++- Rakefile | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.swift-version b/.swift-version index 8c50098..5186d07 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.1 +4.0 diff --git a/.travis.yml b/.travis.yml index 76b328c..ef183b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode8.3 +osx_image: xcode9 cache: bundler: true directories: @@ -8,7 +8,7 @@ cache: before_install: - export LANG=en_US.UTF-8 - xcrun instruments -s devices - - xcrun instruments -w "iPhone 7 (10.3.1) [" || true + - xcrun instruments -w "iPhone 8 (11.0) [" || true install: - make install before_script: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e8cc94..34aec95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.5.0 + +* Swift 4.0 + ## v1.4.1 * Fix `tokenField(_:didChangeInputText:)` with the delete key [#20](https://github.com/polydice/ICInputAccessory/pull/20) diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index 30b007b..1b668da 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -627,7 +627,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -677,7 +677,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/README.md b/README.md index b3a5bef..7b54fcb 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Try . [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ICInputAccessory.svg)](https://cocoapods.org/pods/ICInputAccessory) ![Platform](https://img.shields.io/cocoapods/p/ICInputAccessory.svg) -![Swift 3.1](https://img.shields.io/badge/Swift-3.1-orange.svg) +![Swift 4](https://img.shields.io/badge/Swift-4.0-orange.svg) ### ICKeyboardDismissTextField @@ -31,6 +31,7 @@ ICInputAccessory | iOS | Xcode | Swift `~> 1.2.0` | 8.0+ | 8.0 | ![Swift 2.3](https://img.shields.io/badge/Swift-2.3-orange.svg) `~> 1.3.0` | 8.0+ | 8.0 | ![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg) `~> 1.4.0` | 8.0+ | 8.3 | ![Swift 3.1](https://img.shields.io/badge/Swift-3.1-orange.svg) +`develop` | 8.0+ | 9.0 | ![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg) ## Installation diff --git a/Rakefile b/Rakefile index f557252..c50f84f 100644 --- a/Rakefile +++ b/Rakefile @@ -22,7 +22,7 @@ def xcodebuild(params) %(-workspace ICInputAccessory.xcworkspace), %(-scheme #{params[:scheme]}), %(-sdk iphonesimulator), - %(-destination 'name=iPhone 7,OS=#{params[:version] || "latest"}'), + %(-destination 'name=iPhone 8,OS=#{params[:version] || "latest"}'), %(#{params[:action]} | xcpretty -c && exit ${PIPESTATUS[0]}) ].join " " end From ca252672865744a785be3e63514d31b564eabc31 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 31 Oct 2017 12:22:21 +0800 Subject: [PATCH 5/7] Update SwiftLint to 0.23.1 and fix colon violations --- Example/AppDelegate.swift | 2 +- Example/CustomizedTokenField.swift | 4 ++-- Example/CustomizedTokenViewController.swift | 2 +- ICInputAccessoryUITests/ICTokenFieldUITests.swift | 4 ++-- Podfile | 2 +- Podfile.lock | 8 ++++---- .../ICKeyboardDismissAccessoryView.swift | 2 +- Source/TokenField/ICInsetLabel.swift | 2 +- Source/TokenField/ICToken.swift | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index 23c28d5..f4f077f 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -31,7 +31,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) window?.backgroundColor = UIColor.white window?.rootViewController = UINavigationController(rootViewController: ExampleViewController()) diff --git a/Example/CustomizedTokenField.swift b/Example/CustomizedTokenField.swift index 1f2fbeb..851d5bd 100644 --- a/Example/CustomizedTokenField.swift +++ b/Example/CustomizedTokenField.swift @@ -57,7 +57,7 @@ extension ICTokenField { layer.cornerRadius = 5 layer.shouldRasterize = true layer.rasterizationScale = UIScreen.main.scale - backgroundColor = UIColor(red:0.8, green:0.32, blue:0.24, alpha:1) + backgroundColor = UIColor(red: 0.8, green: 0.32, blue: 0.24, alpha: 1) textField.textColor = UIColor.white textField.tintColor = UIColor.white @@ -78,7 +78,7 @@ extension ICTokenField { ] highlightedTokenAttributes = [ - .foregroundColor: UIColor(red:0.8, green:0.32, blue:0.24, alpha:1), + .foregroundColor: UIColor(red: 0.8, green: 0.32, blue: 0.24, alpha: 1), .backgroundColor: UIColor.white, .font: UIFont.boldSystemFont(ofSize: 14) ] diff --git a/Example/CustomizedTokenViewController.swift b/Example/CustomizedTokenViewController.swift index fc5e5cf..0d199f7 100644 --- a/Example/CustomizedTokenViewController.swift +++ b/Example/CustomizedTokenViewController.swift @@ -48,7 +48,7 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { override func viewDidLoad() { super.viewDidLoad() - navigationController?.navigationBar.barTintColor = UIColor(red:0.96, green:0.48, blue:0.4, alpha:1) + navigationController?.navigationBar.barTintColor = UIColor(red: 0.96, green: 0.48, blue: 0.4, alpha: 1) navigationController?.navigationBar.isTranslucent = false navigationController?.navigationBar.barStyle = .black diff --git a/ICInputAccessoryUITests/ICTokenFieldUITests.swift b/ICInputAccessoryUITests/ICTokenFieldUITests.swift index aa78ce6..f852d63 100644 --- a/ICInputAccessoryUITests/ICTokenFieldUITests.swift +++ b/ICInputAccessoryUITests/ICTokenFieldUITests.swift @@ -56,7 +56,7 @@ class ICTokenFieldUITests: XCTestCase { } func testTokenField() { - let textField = app.tables.cells.containing(.staticText, identifier:"ICTokenField").children(matching: .textField).element + let textField = app.tables.cells.containing(.staticText, identifier: "ICTokenField").children(matching: .textField).element typeTexts(in: textField) } @@ -68,7 +68,7 @@ class ICTokenFieldUITests: XCTestCase { func testStoryboard() { app.tables.buttons["Storyboard"].tap() - let tokenField = app.tables.cells.containing(.staticText, identifier:"Storyboard ICTokenField").children(matching: .textField).element + let tokenField = app.tables.cells.containing(.staticText, identifier: "Storyboard ICTokenField").children(matching: .textField).element typeTexts(in: tokenField) app.tables.buttons["Back to Code"].tap() } diff --git a/Podfile b/Podfile index ed37347..4cbbbf0 100644 --- a/Podfile +++ b/Podfile @@ -5,5 +5,5 @@ workspace "ICInputAccessory" project "ICInputAccessory" target "Example" do - pod "SwiftLint", "0.19.0" + pod "SwiftLint", "0.23.1" end diff --git a/Podfile.lock b/Podfile.lock index e4a0c1d..64b2681 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,12 +1,12 @@ PODS: - - SwiftLint (0.19.0) + - SwiftLint (0.23.1) DEPENDENCIES: - - SwiftLint (= 0.19.0) + - SwiftLint (= 0.23.1) SPEC CHECKSUMS: - SwiftLint: 3537a05b34060e78e7510f04fb7537d738247803 + SwiftLint: 1b670ce79284c76520f84060e87d645078fd32fa -PODFILE CHECKSUM: 0709dcae81d808b2c03cbe4911faac9680768b93 +PODFILE CHECKSUM: dec0ae8a38d3fe9451404a87c1e15577f6685e53 COCOAPODS: 1.3.1 diff --git a/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift b/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift index 7209502..3db96f8 100644 --- a/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift +++ b/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift @@ -53,7 +53,7 @@ open class ICKeyboardDismissAccessoryView: UIView { }() private struct Constants { - static let ButtonColor = UIColor(red:0.21, green:0.2, blue:0.19, alpha:0.5) + static let ButtonColor = UIColor(red: 0.21, green: 0.2, blue: 0.19, alpha: 0.5) static let EdgePadding = CGFloat(7) static let InteractiveSize = CGSize(width: 44, height: 44) } diff --git a/Source/TokenField/ICInsetLabel.swift b/Source/TokenField/ICInsetLabel.swift index a696e48..5a3abc0 100644 --- a/Source/TokenField/ICInsetLabel.swift +++ b/Source/TokenField/ICInsetLabel.swift @@ -44,7 +44,7 @@ class ICInsetLabel: UILabel { switch cornerRadius { case let .constant(radius) where radius > 0: layer.cornerRadius = radius - fallthrough + fallthrough // swiftlint:disable:this fallthrough case .dynamic: layer.masksToBounds = true layer.shouldRasterize = true diff --git a/Source/TokenField/ICToken.swift b/Source/TokenField/ICToken.swift index 6b65a42..c0a840f 100644 --- a/Source/TokenField/ICToken.swift +++ b/Source/TokenField/ICToken.swift @@ -42,7 +42,7 @@ class ICToken: UIView { } var normalTextAttributes: [NSAttributedStringKey: NSObject] = [ - .foregroundColor: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1), + .foregroundColor: UIColor(red: 0.14, green: 0.38, blue: 0.95, alpha: 1), .backgroundColor: UIColor.clear ] { didSet { @@ -53,7 +53,7 @@ class ICToken: UIView { var highlightedTextAttributes: [NSAttributedStringKey: NSObject] = [ .foregroundColor: UIColor.white, - .backgroundColor: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1) + .backgroundColor: UIColor(red: 0.14, green: 0.38, blue: 0.95, alpha: 1) ] { didSet { if isHighlighted { updateTextLabel() } From e7990d37176a69f81a98f5a7bd90b8073a5a4808 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 1 Nov 2017 00:00:07 +0800 Subject: [PATCH 6/7] Simplify the UILayoutPriority conversion --- Source/TokenField/ICTokenField.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 006ef5a..74fcc45 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -114,7 +114,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega if placeholderLabel.superview != nil { return } insertSubview(placeholderLabel, belowSubview: scrollView) placeholderLabel.translatesAutoresizingMaskIntoConstraints = false - placeholderLabel.setContentHuggingPriority(UILayoutPriority(rawValue: UILayoutPriority.RawValue(Int(UILayoutPriority.defaultLow.rawValue) - 1)), for: .horizontal) + placeholderLabel.setContentHuggingPriority(UILayoutPriority(rawValue: UILayoutPriority.defaultLow.rawValue - 1), for: .horizontal) addConstraint(NSLayoutConstraint(item: placeholderLabel, attribute: .leading, relatedBy: .equal, toItem: scrollView, attribute: .leading, multiplier: 1, constant: 0)) addConstraint(NSLayoutConstraint(item: placeholderLabel, attribute: .trailing, relatedBy: .greaterThanOrEqual, toItem: scrollView, attribute: .trailing, multiplier: 1, constant: 10)) addConstraint(NSLayoutConstraint(item: placeholderLabel, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: 0)) From 0167a3051aaed51d5ddd79fa40ba0b90b57f2f0c Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 22 Jan 2018 17:31:01 +0800 Subject: [PATCH 7/7] Update Gems with Ruby 2.4.3 --- .ruby-version | 2 +- Gemfile.lock | 54 +++++++++++++++++++++++++-------------------------- Podfile.lock | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.ruby-version b/.ruby-version index 8e8299d..35cee72 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.2 +2.4.3 diff --git a/Gemfile.lock b/Gemfile.lock index a22be3e..df1aac4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: http://rubygems.org/ specs: - CFPropertyList (2.3.5) + CFPropertyList (2.3.6) activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) @@ -14,30 +14,30 @@ GEM cork nap open4 (~> 1.3) - cocoapods (1.3.1) + cocoapods (1.4.0) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.3.1) - cocoapods-deintegrate (>= 1.0.1, < 2.0) + cocoapods-core (= 1.4.0) + cocoapods-deintegrate (>= 1.0.2, < 2.0) cocoapods-downloader (>= 1.1.3, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.2.0, < 2.0) + cocoapods-trunk (>= 1.3.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) fourflusher (~> 2.0.1) gh_inspector (~> 1.0) - molinillo (~> 0.5.7) + molinillo (~> 0.6.4) nap (~> 1.0) ruby-macho (~> 1.1) - xcodeproj (>= 1.5.1, < 2.0) - cocoapods-core (1.3.1) + xcodeproj (>= 1.5.4, < 2.0) + cocoapods-core (1.4.0) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.1) + cocoapods-deintegrate (1.0.2) cocoapods-downloader (1.1.3) cocoapods-plugins (1.0.0) nap @@ -52,7 +52,7 @@ GEM concurrent-ruby (1.0.5) cork (0.3.0) colored2 (~> 3.1) - danger (5.5.3) + danger (5.5.6) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -65,7 +65,7 @@ GEM octokit (~> 4.7) terminal-table (~> 1) escape (0.0.4) - faraday (0.13.1) + faraday (0.14.0) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) @@ -74,43 +74,43 @@ GEM fuzzy_match (2.0.4) gh_inspector (1.0.3) git (1.3.0) - i18n (0.9.0) + i18n (0.9.1) concurrent-ruby (~> 1.0) - jazzy (0.9.0) + jazzy (0.9.1) cocoapods (~> 1.0) mustache (~> 0.99) open4 redcarpet (~> 3.2) - rouge (~> 1.5) + rouge (>= 2.0.6, < 4.0) sass (~> 3.4) sqlite3 (~> 1.3) xcinvoke (~> 0.3.0) - kramdown (1.15.0) + kramdown (1.16.2) liferaft (0.0.6) method_source (0.9.0) - minitest (5.10.3) - molinillo (0.5.7) + minitest (5.11.1) + molinillo (0.6.4) multipart-post (2.0.0) mustache (0.99.8) nanaimo (0.2.3) nap (1.1.0) netrc (0.11.0) no_proxy_fix (0.1.2) - octokit (4.7.0) + octokit (4.8.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - pry (0.11.2) + pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) - public_suffix (3.0.0) - rake (12.2.1) + public_suffix (3.0.1) + rake (12.3.0) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redcarpet (3.4.0) - rouge (1.11.1) + rouge (2.0.7) ruby-macho (1.1.0) - sass (3.5.3) + sass (3.5.5) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -127,13 +127,13 @@ GEM unicode-display_width (1.3.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.5.3) + xcodeproj (1.5.4) CFPropertyList (~> 2.3.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.2.3) - xcpretty (0.2.6) - rouge (~> 1.8) + xcpretty (0.2.8) + rouge (~> 2.0.7) PLATFORMS ruby @@ -147,4 +147,4 @@ DEPENDENCIES xcpretty BUNDLED WITH - 1.15.4 + 1.16.1 diff --git a/Podfile.lock b/Podfile.lock index 64b2681..95ba7e0 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -9,4 +9,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: dec0ae8a38d3fe9451404a87c1e15577f6685e53 -COCOAPODS: 1.3.1 +COCOAPODS: 1.4.0