From 96aff5633abc1cda4bdda07d160c9e10de3353fa Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 7 Jun 2016 16:57:29 +0800 Subject: [PATCH 1/8] Remove the repeated `let` statements in conditional binding cascade --- Source/TokenField/ICTokenField.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 2f8b237..627b39c 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -282,9 +282,9 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele removeHighlightedToken() // as user starts typing when a token is focused inputTextField.showsCursor = true - guard - let input = textField.text, - let text: NSString = (input as NSString).stringByReplacingCharactersInRange(range, withString: string) + guard let + input = textField.text, + text: NSString = (input as NSString).stringByReplacingCharactersInRange(range, withString: string) else { return true } From 75d607dde7e5ebf3ec6c65c608294d91bf3d575e Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 7 Jun 2016 17:31:07 +0800 Subject: [PATCH 2/8] Use the Selector syntax sugar --- Example/Example/CustomizedTokenViewController.swift | 10 +++++++++- Example/Example/ExampleViewController.swift | 10 +++++++++- .../ICKeyboardDismissTextField.swift | 10 +++++++++- Source/TokenField/ICTokenField.swift | 13 +++++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Example/Example/CustomizedTokenViewController.swift b/Example/Example/CustomizedTokenViewController.swift index ab1229d..2f7ae64 100644 --- a/Example/Example/CustomizedTokenViewController.swift +++ b/Example/Example/CustomizedTokenViewController.swift @@ -50,7 +50,7 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { navigationController?.navigationBar.translucent = false navigationController?.navigationBar.barStyle = .Black - let cancelBarButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(dismiss(_:))) + let cancelBarButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: .dismiss) cancelBarButton.tintColor = UIColor.whiteColor() navigationItem.rightBarButtonItem = cancelBarButton @@ -106,3 +106,11 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { } } + + +//////////////////////////////////////////////////////////////////////////////// + + +private extension Selector { + static let dismiss = #selector(CustomizedTokenViewController.dismiss(_:)) +} diff --git a/Example/Example/ExampleViewController.swift b/Example/Example/ExampleViewController.swift index cfacb8d..f9c6c4f 100644 --- a/Example/Example/ExampleViewController.swift +++ b/Example/Example/ExampleViewController.swift @@ -39,7 +39,7 @@ class ExampleViewController: UITableViewController { let _button = UIButton(type: .System) _button.frame = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 88) _button.setTitle("Storyboard", forState: .Normal) - _button.addTarget(self, action: #selector(showStoryboard(_:)), forControlEvents: .TouchUpInside) + _button.addTarget(self, action: .showStoryboard, forControlEvents: .TouchUpInside) return _button }() @@ -133,3 +133,11 @@ class ExampleViewController: UITableViewController { } } + + +//////////////////////////////////////////////////////////////////////////////// + + +private extension Selector { + static let showStoryboard = #selector(ExampleViewController.showStoryboard(_:)) +} diff --git a/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift b/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift index 20b6443..b0ecdf3 100644 --- a/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift +++ b/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift @@ -32,7 +32,7 @@ public class ICKeyboardDismissTextField: UITextField { @IBOutlet public var keyboardAccessoryView: ICKeyboardDismissAccessoryView! { didSet { if UI_USER_INTERFACE_IDIOM() != .Phone { return } - keyboardAccessoryView.dismissButton.addTarget(self, action: #selector(dismiss(_:)), forControlEvents: .TouchUpInside) + keyboardAccessoryView.dismissButton.addTarget(self, action: .dismiss, forControlEvents: .TouchUpInside) inputAccessoryView = keyboardAccessoryView } } @@ -74,3 +74,11 @@ public class ICKeyboardDismissTextField: UITextField { } } + + +//////////////////////////////////////////////////////////////////////////////// + + +private extension Selector { + static let dismiss = #selector(ICKeyboardDismissTextField.dismiss(_:)) +} diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 627b39c..767bc0f 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -172,7 +172,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele _textField.returnKeyType = .Search _textField.delegate = self _textField.backspaceDelegate = self - _textField.addTarget(self, action: #selector(togglePlaceholderIfNeeded(_:)), forControlEvents: .AllEditingEvents) + _textField.addTarget(self, action: .togglePlaceholderIfNeeded, forControlEvents: .AllEditingEvents) return _textField }() @@ -206,7 +206,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele }() private lazy var tapGestureRecognizer: UITapGestureRecognizer = { - UITapGestureRecognizer(target: self, action: #selector(handleTapGesture(_:))) + UITapGestureRecognizer(target: self, action: .handleTapGesture) }() // MARK: - Initialization @@ -454,3 +454,12 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele } } + + +//////////////////////////////////////////////////////////////////////////////// + + +private extension Selector { + static let togglePlaceholderIfNeeded = #selector(ICTokenField.togglePlaceholderIfNeeded(_:)) + static let handleTapGesture = #selector(ICTokenField.handleTapGesture(_:)) +} From a8d80aaba61fa2b8b0857854aa76dad61ecfe103 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 7 Jun 2016 17:34:38 +0800 Subject: [PATCH 3/8] All interface orientations must be supported unless the app requires full screen --- Example/Example/Info.plist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Example/Example/Info.plist b/Example/Example/Info.plist index 6d52a7c..40a8d93 100644 --- a/Example/Example/Info.plist +++ b/Example/Example/Info.plist @@ -28,11 +28,14 @@ armv7 + UIRequiresFullScreen + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown From c3da75d2cfdb22e117bc769fb6b4edb84381e849 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 9 Jun 2016 23:06:41 -0700 Subject: [PATCH 4/8] Bump version to 1.1.0 --- CHANGELOG.md | 11 ++++++++++- Example/Example/Info.plist | 4 ++-- Example/ICInputAccessoryUITests/Info.plist | 2 +- ICInputAccessory.podspec | 2 +- ICInputAccessory/Info.plist | 2 +- README.md | 6 ++---- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb51ca3..a911495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,17 @@ +## v1.1.0 + +#### Changes + +* Support storyboard +* Support subspecs +* Upgrade to Swift 2.2 +* Use CocoaPods (1.0.1) + ## v1.0.0 Initial release written in Swift 2.1. -#### Added +#### Changes * `ICKeyboardDismissTextField` with an accessory view to dismiss keyboard. * `ICTokenField`, a text field that groups input texts as tokens. diff --git a/Example/Example/Info.plist b/Example/Example/Info.plist index 40a8d93..f41df19 100644 --- a/Example/Example/Info.plist +++ b/Example/Example/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0 + 1.1.0 CFBundleSignature ???? CFBundleVersion - 1 + 101 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/Example/ICInputAccessoryUITests/Info.plist b/Example/ICInputAccessoryUITests/Info.plist index ba72822..3b9aa4a 100644 --- a/Example/ICInputAccessoryUITests/Info.plist +++ b/Example/ICInputAccessoryUITests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.0 + 1.1.0 CFBundleSignature ???? CFBundleVersion diff --git a/ICInputAccessory.podspec b/ICInputAccessory.podspec index c3f15c2..f2d77e7 100644 --- a/ICInputAccessory.podspec +++ b/ICInputAccessory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ICInputAccessory" - s.version = "1.0.0" + s.version = "1.1.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 60b9c00..09bc972 100644 --- a/ICInputAccessory/Info.plist +++ b/ICInputAccessory/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0.0 + 1.1.0 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index 2752b96..02cdbfe 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,8 @@ Try . ICInputAccessory | iOS | Xcode | Swift ---------------- | :--: | :---: | ----- -v1.0.0 | 8.0+ | 7.2 | ![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg) -v1.1.0 | 8.0+ | 7.3 | ![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg) - -iOS 8.0+ with Xcode 7.2 or above. +`~> v1.0.0` | 8.0+ | 7.2 | ![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg) +`~> v1.1.0` | 8.0+ | 7.3 | ![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg) ## Installation From 2b73bd0115c246a30c16dc288664653ae1ec2bd2 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 10 Jun 2016 09:28:43 -0700 Subject: [PATCH 5/8] Update to CocoaPods (1.0.1) --- Example/Example.xcodeproj/project.pbxproj | 18 +++++++++--------- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- Podfile.lock | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index d53a7fc..1716855 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -163,12 +163,12 @@ isa = PBXNativeTarget; buildConfigurationList = B5E9F90D1C8D3B6E00443DC7 /* Build configuration list for PBXNativeTarget "Example" */; buildPhases = ( - 96705876C946719953BCD0C6 /* 📦 Check Pods Manifest.lock */, + 96705876C946719953BCD0C6 /* [CP] Check Pods Manifest.lock */, B5E9F8F71C8D3B6E00443DC7 /* Sources */, B5E9F8F81C8D3B6E00443DC7 /* Frameworks */, B5E9F8F91C8D3B6E00443DC7 /* Resources */, - CAB3B20531AAE2438C48D751 /* 📦 Embed Pods Frameworks */, - 7B2FB96C7361D5883F3ADD14 /* 📦 Copy Pods Resources */, + CAB3B20531AAE2438C48D751 /* [CP] Embed Pods Frameworks */, + 7B2FB96C7361D5883F3ADD14 /* [CP] Copy Pods Resources */, B5C50ADD1C917F4A0059032B /* Swift Lint */, ); buildRules = ( @@ -240,14 +240,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 7B2FB96C7361D5883F3ADD14 /* 📦 Copy Pods Resources */ = { + 7B2FB96C7361D5883F3ADD14 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Copy Pods Resources"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -255,14 +255,14 @@ shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 96705876C946719953BCD0C6 /* 📦 Check Pods Manifest.lock */ = { + 96705876C946719953BCD0C6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Check Pods Manifest.lock"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -284,14 +284,14 @@ shellPath = /bin/sh; shellScript = "if which swiftlint >/dev/null; then swiftlint; fi"; }; - CAB3B20531AAE2438C48D751 /* 📦 Embed Pods Frameworks */ = { + CAB3B20531AAE2438C48D751 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Embed Pods Frameworks"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Gemfile b/Gemfile index f27c031..309c365 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" ruby "2.3.1" -gem "cocoapods", "1.0.0" +gem "cocoapods", "~> 1.0.0" gem "pry" gem "rake" gem "xcpretty" diff --git a/Gemfile.lock b/Gemfile.lock index 831d0fd..3b967b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,10 +8,10 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) claide (1.0.0) - cocoapods (1.0.0) + cocoapods (1.0.1) activesupport (>= 4.0.2) claide (>= 1.0.0, < 2.0) - cocoapods-core (= 1.0.0) + cocoapods-core (= 1.0.1) cocoapods-deintegrate (>= 1.0.0, < 2.0) cocoapods-downloader (>= 1.0.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -24,8 +24,8 @@ GEM fourflusher (~> 0.3.0) molinillo (~> 0.4.5) nap (~> 1.0) - xcodeproj (>= 1.0.0, < 2.0) - cocoapods-core (1.0.0) + xcodeproj (>= 1.1.0, < 2.0) + cocoapods-core (1.0.1) activesupport (>= 4.0.2) fuzzy_match (~> 2.0.4) nap (~> 1.0) @@ -56,12 +56,12 @@ GEM method_source (~> 0.8.1) slop (~> 3.4) rake (11.1.2) - rouge (1.10.1) + rouge (1.11.0) slop (3.6.0) thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) - xcodeproj (1.0.0) + xcodeproj (1.1.0) activesupport (>= 3) claide (>= 1.0.0, < 2.0) colored (~> 1.2) @@ -72,7 +72,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.0.0) + cocoapods (~> 1.0.0) pry rake xcpretty diff --git a/Podfile.lock b/Podfile.lock index bdb9ac8..31383d6 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,6 +1,6 @@ PODS: - - ICInputAccessory/KeyboardDismissTextField (1.0.0) - - ICInputAccessory/TokenField (1.0.0) + - ICInputAccessory/KeyboardDismissTextField (1.1.0) + - ICInputAccessory/TokenField (1.1.0) DEPENDENCIES: - ICInputAccessory/KeyboardDismissTextField (from `./`) @@ -11,8 +11,8 @@ EXTERNAL SOURCES: :path: "./" SPEC CHECKSUMS: - ICInputAccessory: e3c0705263aa7c86cebf96425c95aa716ec83f25 + ICInputAccessory: fa69a534ae8811866fa9d63a6b3ecf07bfced685 PODFILE CHECKSUM: bc37f46eb6efd595acab704850534a8198e06d74 -COCOAPODS: 1.0.0 +COCOAPODS: 1.0.1 From ae6b523112faf809ada7ca7c49e4eff2e8687d5b Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 24 Jul 2016 22:16:52 +0800 Subject: [PATCH 6/8] Update Gems --- Gemfile.lock | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3b967b2..2ac56c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,10 @@ GEM remote: http://rubygems.org/ specs: - activesupport (4.2.6) + activesupport (5.0.0) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) claide (1.0.0) cocoapods (1.0.1) @@ -30,7 +29,7 @@ GEM fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.0) - cocoapods-downloader (1.0.0) + cocoapods-downloader (1.1.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) @@ -38,30 +37,30 @@ GEM cocoapods-trunk (1.0.0) nap (>= 0.8, < 2.0) netrc (= 0.7.8) - cocoapods-try (1.0.0) + cocoapods-try (1.1.0) coderay (1.1.1) colored (1.2) + concurrent-ruby (1.0.2) escape (0.0.4) - fourflusher (0.3.1) + fourflusher (0.3.2) fuzzy_match (2.0.4) i18n (0.7.0) - json (1.8.3) method_source (0.8.2) minitest (5.9.0) molinillo (0.4.5) nap (1.1.0) netrc (0.7.8) - pry (0.10.3) + pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - rake (11.1.2) - rouge (1.11.0) + rake (11.2.2) + rouge (1.11.1) slop (3.6.0) thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) - xcodeproj (1.1.0) + xcodeproj (1.2.0) activesupport (>= 3) claide (>= 1.0.0, < 2.0) colored (~> 1.2) From bfef2934793348ebd1dd24b881d5e00a26048cb4 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 24 Jul 2016 22:21:17 +0800 Subject: [PATCH 7/8] Disable UI testing until testing failure with status (65) is resolved --- .travis.yml | 2 +- Rakefile | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fa40334..4c734a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: before_script: - xcodebuild -workspace ICInputAccessory.xcworkspace -list script: - - bundle exec rake ci:test[$VERSION] + - bundle exec rake ci:build[$VERSION] notifications: email: false slack: diff --git a/Rakefile b/Rakefile index 4885628..f138ad8 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,13 @@ task default: "ci:test" namespace :ci do + desc "Build targets on Travis CI with a specified OS version, default OS=latest" + task :build, [:os] do |t, args| + version = args[:os] || "latest" + Rake::Task["framework:build"].invoke version + Rake::Task["example:build"].invoke version + end + desc "Run tests on Travis CI with a specified OS version, default OS=latest" task :test, [:os] do |t, args| version = args[:os] || "latest" From 613aa74cf96207093febed1c471d48be17ecb46c Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 3 Aug 2016 19:42:37 +0800 Subject: [PATCH 8/8] Add more detailed steps to set up the project --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 02cdbfe..6546e0b 100644 --- a/README.md +++ b/README.md @@ -134,15 +134,19 @@ See `Example/CustomizedTokenField.swift` for more details. ## Development -Meke sure you have [Homebrew](http://brew.sh/) installed, then run in the project root: +* Meke sure [Homebrew](http://brew.sh/) is installed. +* Current `develop` branch requires Ruby `2.3.1`. +* Set up dependencies by running the following command in the project root: -``` + ``` make setup ``` -Tasks for testing: +* Open **ICInputAccessory.xcworkspace** and run the demo app with the `Example` scheme. -``` +* See more tasks for building and testing: + + ``` rake -T ```