From 5b9c92ac6c0c47213234a5ec9b50681d1586b261 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 30 Oct 2017 23:11:28 +0800 Subject: [PATCH 01/15] 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 02/15] 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 03/15] 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 04/15] 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 05/15] 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 06/15] 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 07/15] 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 From dac456cd80a3c1c170efa057e8f2f9e13750859c Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 10 Apr 2018 20:49:17 +0800 Subject: [PATCH 08/15] Update to Xcode 9.3 recommended settings --- ICInputAccessory.xcodeproj/project.pbxproj | 6 +++++- .../xcshareddata/xcschemes/Example.xcscheme | 4 +--- .../xcshareddata/xcschemes/ICInputAccessory-iOS.xcscheme | 4 +--- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 ICInputAccessory.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index 1b668da..d15f5d2 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -299,7 +299,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Polydice, Inc."; TargetAttributes = { B53376871F4436D000230739 = { @@ -589,12 +589,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -647,12 +649,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index 34be65e..46dccad 100644 --- a/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/ICInputAccessory.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ICInputAccessory.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ICInputAccessory.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + From b7a25a7ba5c4f52c2a91690756efda7f38e7c066 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 10 Apr 2018 20:43:41 +0800 Subject: [PATCH 09/15] Avoid recloning the repo when generating docs --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index afc9367..1911208 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ carthage: set -o pipefail && carthage build --no-skip-current --verbose | bundle exec xcpretty docs: - rm -rfv docs - git clone -b gh-pages --single-branch https://github.com/polydice/ICInputAccessory.git docs + test -d docs || git clone -b gh-pages --single-branch https://github.com/polydice/ICInputAccessory.git docs + cd docs && git fetch origin gh-pages && git clean -f -d + cd docs && git checkout gh-pages && git reset --hard origin/gh-pages bundle exec jazzy --config .jazzy.yml From 97ff8b11068f6c1a04d93ae95169c8e17f9fb263 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 23 Jan 2018 17:09:59 +0800 Subject: [PATCH 10/15] Skip documentation updates from pull request builds --- scripts/update-docs.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh index daf0471..e9a342b 100644 --- a/scripts/update-docs.sh +++ b/scripts/update-docs.sh @@ -17,13 +17,14 @@ git --no-pager diff --stat git add . git commit -m "[CI] Update documentation at $(date +'%Y-%m-%d %H:%M:%S %z')" -if [ "${TRAVIS_BRANCH}" = "develop" ] && [ -n "$DANGER_GITHUB_API_TOKEN" ]; then +if [ "${TRAVIS_COMMIT_MESSAGE}" = Merge* ] && [ -n "$DANGER_GITHUB_API_TOKEN" ]; then echo "Updating gh-pages..." git remote add upstream "https://${DANGER_GITHUB_API_TOKEN}@github.com/polydice/ICInputAccessory.git" git push --quiet upstream HEAD:gh-pages git remote remove upstream else - echo "Skip gh-pages updates on ${TRAVIS_BRANCH}" + echo "Skip gh-pages updates on ${TRAVIS_BRANCH}:" + echo "\n ${TRAVIS_COMMIT_MESSAGE}\n" fi cd - From eafe2297a0ad344a377ecd89a384f58e672614cc Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 10 Apr 2018 20:51:17 +0800 Subject: [PATCH 11/15] Upgrade to CocoaPods (1.5.0) --- Gemfile.lock | 48 +++++++++++----------- ICInputAccessory.xcodeproj/project.pbxproj | 32 --------------- Podfile.lock | 6 ++- 3 files changed, 30 insertions(+), 56 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index df1aac4..4f0af0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: http://rubygems.org/ specs: - CFPropertyList (2.3.6) + CFPropertyList (3.0.0) activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) @@ -9,17 +9,18 @@ GEM tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) + atomos (0.1.2) claide (1.0.2) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.4.0) + cocoapods (1.5.0) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.4.0) + cocoapods-core (= 1.5.0) cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.1.3, < 2.0) + cocoapods-downloader (>= 1.2.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) @@ -29,16 +30,16 @@ GEM escape (~> 0.0.4) fourflusher (~> 2.0.1) gh_inspector (~> 1.0) - molinillo (~> 0.6.4) + molinillo (~> 0.6.5) nap (~> 1.0) ruby-macho (~> 1.1) - xcodeproj (>= 1.5.4, < 2.0) - cocoapods-core (1.4.0) + xcodeproj (>= 1.5.7, < 2.0) + cocoapods-core (1.5.0) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.1.3) + cocoapods-downloader (1.2.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) @@ -52,7 +53,7 @@ GEM concurrent-ruby (1.0.5) cork (0.3.0) colored2 (~> 3.1) - danger (5.5.6) + danger (5.5.11) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -69,12 +70,12 @@ GEM multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) - ffi (1.9.18) + ffi (1.9.23) fourflusher (2.0.1) fuzzy_match (2.0.4) - gh_inspector (1.0.3) + gh_inspector (1.1.3) git (1.3.0) - i18n (0.9.1) + i18n (0.9.5) concurrent-ruby (~> 1.0) jazzy (0.9.1) cocoapods (~> 1.0) @@ -88,11 +89,11 @@ GEM kramdown (1.16.2) liferaft (0.0.6) method_source (0.9.0) - minitest (5.11.1) - molinillo (0.6.4) + minitest (5.11.3) + molinillo (0.6.5) multipart-post (2.0.0) mustache (0.99.8) - nanaimo (0.2.3) + nanaimo (0.2.5) nap (1.1.0) netrc (0.11.0) no_proxy_fix (0.1.2) @@ -102,15 +103,15 @@ GEM pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) - public_suffix (3.0.1) - rake (12.3.0) - rb-fsevent (0.10.2) + public_suffix (3.0.2) + rake (12.3.1) + rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redcarpet (3.4.0) rouge (2.0.7) ruby-macho (1.1.0) - sass (3.5.5) + sass (3.5.6) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -122,16 +123,17 @@ GEM terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.3.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.5.4) - CFPropertyList (~> 2.3.3) + xcodeproj (1.5.7) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.2) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.3) + nanaimo (~> 0.2.4) xcpretty (0.2.8) rouge (~> 2.0.7) diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index d15f5d2..b2cdef4 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -242,8 +242,6 @@ B53376841F4436D000230739 /* Sources */, B53376851F4436D000230739 /* Frameworks */, B53376861F4436D000230739 /* Resources */, - 9192772A7DBF8B1D3D564448 /* [CP] Embed Pods Frameworks */, - B00B735ECB485DFE7B769A68 /* [CP] Copy Pods Resources */, B5E619CA1F44A04A005200E1 /* Embed Frameworks */, ); buildRules = ( @@ -386,36 +384,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 9192772A7DBF8B1D3D564448 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - B00B735ECB485DFE7B769A68 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; B5FCC31F1F44943A003F7D34 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Podfile.lock b/Podfile.lock index 95ba7e0..b37887d 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -4,9 +4,13 @@ PODS: DEPENDENCIES: - SwiftLint (= 0.23.1) +SPEC REPOS: + https://github.com/CocoaPods/Specs.git: + - SwiftLint + SPEC CHECKSUMS: SwiftLint: 1b670ce79284c76520f84060e87d645078fd32fa PODFILE CHECKSUM: dec0ae8a38d3fe9451404a87c1e15577f6685e53 -COCOAPODS: 1.4.0 +COCOAPODS: 1.5.0 From ff52a8b67e87441fdc1b5ec3f721534245da478a Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 10 Apr 2018 22:13:42 +0800 Subject: [PATCH 12/15] Update to SwiftLint (0.25.1) --- .swiftlint.yml | 1 + ICInputAccessory.xcodeproj/project.pbxproj | 2 +- Podfile | 2 +- Podfile.lock | 14 +++++++------- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index a9a6baa..47840f9 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,5 +1,6 @@ disabled_rules: - file_length + - identifier_name - line_length - type_body_length - vertical_whitespace diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index b2cdef4..ed0d0c2 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -396,7 +396,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "${PODS_ROOT}/SwiftLint/swiftlint"; + shellScript = "${PODS_ROOT}/SwiftLint/swiftlint --config .swiftlint.yml"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Podfile b/Podfile index 4cbbbf0..92d410b 100644 --- a/Podfile +++ b/Podfile @@ -5,5 +5,5 @@ workspace "ICInputAccessory" project "ICInputAccessory" target "Example" do - pod "SwiftLint", "0.23.1" + pod "SwiftLint", podspec: "https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/4/0/1/SwiftLint/0.25.1/SwiftLint.podspec.json" end diff --git a/Podfile.lock b/Podfile.lock index b37887d..f2859e3 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,16 +1,16 @@ PODS: - - SwiftLint (0.23.1) + - SwiftLint (0.25.1) DEPENDENCIES: - - SwiftLint (= 0.23.1) + - SwiftLint (from `https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/4/0/1/SwiftLint/0.25.1/SwiftLint.podspec.json`) -SPEC REPOS: - https://github.com/CocoaPods/Specs.git: - - SwiftLint +EXTERNAL SOURCES: + SwiftLint: + :podspec: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/4/0/1/SwiftLint/0.25.1/SwiftLint.podspec.json SPEC CHECKSUMS: - SwiftLint: 1b670ce79284c76520f84060e87d645078fd32fa + SwiftLint: ce933681be10c3266e82576dad676fa815a602e9 -PODFILE CHECKSUM: dec0ae8a38d3fe9451404a87c1e15577f6685e53 +PODFILE CHECKSUM: 74bc2bf59f17e7cc006ae2aa1d4d73e50cc2b4ff COCOAPODS: 1.5.0 From 2b8dc47ec33c3ea2c083f774bd57b10c69bea75d Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 10 Apr 2018 22:10:16 +0800 Subject: [PATCH 13/15] Specify Swift 4 in the podspec --- .swift-version | 2 +- .travis.yml | 4 ++-- ICInputAccessory.podspec | 1 + Source/TokenField/ICTokenField.swift | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.swift-version b/.swift-version index 5186d07..7d5c902 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +4.1 diff --git a/.travis.yml b/.travis.yml index ef183b1..acd6754 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode9 +osx_image: xcode9.3beta 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 8 (11.0) [" || true + - open -b com.apple.iphonesimulator install: - make install before_script: diff --git a/ICInputAccessory.podspec b/ICInputAccessory.podspec index 82864e5..45a5dec 100644 --- a/ICInputAccessory.podspec +++ b/ICInputAccessory.podspec @@ -19,6 +19,7 @@ Pod::Spec.new do |s| s.license = { type: "MIT", file: "LICENSE" } s.authors = "bcylin", "trisix" s.platform = :ios, "8.0" + s.swift_version = "4.0" s.source = { git: "https://github.com/polydice/ICInputAccessory.git", tag: "v#{s.version}" } s.requires_arc = true diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 74fcc45..2eda3f9 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -300,7 +300,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega continue } - let index = text.index(text.endIndex, offsetBy: -delimiter.characters.count) + let index = text.index(text.endIndex, offsetBy: -delimiter.count) let newText = String(text[.. Date: Tue, 10 Apr 2018 22:17:59 +0800 Subject: [PATCH 14/15] Bump version to 1.5.0 --- .jazzy.yml | 2 +- Example/Info.plist | 2 +- ICInputAccessory.podspec | 2 +- ICInputAccessory/Info.plist | 2 +- ICInputAccessoryUITests/Info.plist | 2 +- README.md | 5 ++--- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.jazzy.yml b/.jazzy.yml index 31fc459..f34448a 100644 --- a/.jazzy.yml +++ b/.jazzy.yml @@ -5,7 +5,7 @@ github_url: https://github.com/polydice/ICInputAccessory github_file_prefix: https://github.com/polydice/ICInputAccessory/blob/develop xcodebuild_arguments: [-project, ICInputAccessory.xcodeproj, -scheme, ICInputAccessory-iOS] module: ICInputAccessory -module_version: 1.4.1 +module_version: 1.5.0 output: docs/output theme: fullwidth skip_undocumented: true diff --git a/Example/Info.plist b/Example/Info.plist index dba6410..312984f 100644 --- a/Example/Info.plist +++ b/Example/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.4.1 + 1.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/ICInputAccessory.podspec b/ICInputAccessory.podspec index 45a5dec..d744630 100644 --- a/ICInputAccessory.podspec +++ b/ICInputAccessory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ICInputAccessory" - s.version = "1.4.1" + s.version = "1.5.0" s.summary = "A customized token text field used in the iCook app." s.description = <<-DESC ICKeyboardDismissTextField: diff --git a/ICInputAccessory/Info.plist b/ICInputAccessory/Info.plist index 07b3f7e..beed82a 100644 --- a/ICInputAccessory/Info.plist +++ b/ICInputAccessory/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.4.1 + 1.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/ICInputAccessoryUITests/Info.plist b/ICInputAccessoryUITests/Info.plist index b01e690..ceb8ddd 100644 --- a/ICInputAccessoryUITests/Info.plist +++ b/ICInputAccessoryUITests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.4.1 + 1.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index 7b54fcb..ae52bcb 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ # ICInputAccessory Customized text fields used in the [iCook app](https://itunes.apple.com/app/id554065086). -Try . [![Build Status](https://travis-ci.org/polydice/ICInputAccessory.svg)](https://travis-ci.org/polydice/ICInputAccessory) [![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 4](https://img.shields.io/badge/Swift-4.0-orange.svg) +![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg) ### ICKeyboardDismissTextField @@ -31,7 +30,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) +`~> 1.5.0` | 8.0+ | 9.3 | ![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg) ## Installation From 8cb56bf777de507196565a178bd01e5ffa0ddc5c Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 11 Apr 2018 23:02:59 +0800 Subject: [PATCH 15/15] Update documentation only on master branch --- scripts/update-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh index e9a342b..59e8033 100644 --- a/scripts/update-docs.sh +++ b/scripts/update-docs.sh @@ -17,7 +17,7 @@ git --no-pager diff --stat git add . git commit -m "[CI] Update documentation at $(date +'%Y-%m-%d %H:%M:%S %z')" -if [ "${TRAVIS_COMMIT_MESSAGE}" = Merge* ] && [ -n "$DANGER_GITHUB_API_TOKEN" ]; then +if [ "${TRAVIS_COMMIT_MESSAGE}" = Merge* ] && [ "${TRAVIS_BRANCH}" = "master" ] && [ -n "$DANGER_GITHUB_API_TOKEN" ]; then echo "Updating gh-pages..." git remote add upstream "https://${DANGER_GITHUB_API_TOKEN}@github.com/polydice/ICInputAccessory.git" git push --quiet upstream HEAD:gh-pages