From 8fc5b2e3e6c7b7636ce28b5b10c293f5b14c7ce0 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 4 Feb 2017 14:52:41 +0800 Subject: [PATCH 01/11] Rename tokenField(_:didCompleteText:) --- Example/CustomizedTokenViewController.swift | 2 +- README.md | 2 +- Source/TokenField/ICTokenField.swift | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Example/CustomizedTokenViewController.swift b/Example/CustomizedTokenViewController.swift index 907ef61..d816bcd 100644 --- a/Example/CustomizedTokenViewController.swift +++ b/Example/CustomizedTokenViewController.swift @@ -83,7 +83,7 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { print(#function) } - func tokenField(_ tokenField: ICTokenField, didEnterText text: String) { + func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) { print("Add: \"\(text)\"") updateTexts() } diff --git a/README.md b/README.md index 97b2500..3a3acb3 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ See `Example/CustomizedTokenField.swift` for more details. * `tokenFieldDidBeginEditing(_:)` * `tokenFieldDidEndEditing(_:)` * `tokenFieldWillReturn(_:)` -* `tokenField(_:didEnterText:)` +* `tokenField(_:didCompleteText:)` * `tokenField(_:didDeleteText:atIndex:)` ## Development diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index eeed91c..715bb5b 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -35,7 +35,7 @@ import UIKit /// Tells the delegate that the token field will process the pressing of the return button. @objc optional func tokenFieldWillReturn(_ tokenField: ICTokenField) /// Tells the delegate that the text becomes a token in the token field. - @objc optional func tokenField(_ tokenField: ICTokenField, didEnterText text: String) + @objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) /// Tells the delegate that the token at certain index is removed from the token field. @objc optional func tokenField(_ tokenField: ICTokenField, didDeleteText text: String, atIndex index: Int) } @@ -297,7 +297,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega if !newToken.isEmpty && newToken != delimiter { tokens.append(ICToken(text: newToken, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) layoutTokenTextField() - delegate?.tokenField?(self, didEnterText: newToken) + delegate?.tokenField?(self, didCompleteText: newToken) } togglePlaceholderIfNeeded() @@ -439,7 +439,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega inputTextField.text = nil tokens.append(ICToken(text: text, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) layoutTokenTextField() - delegate?.tokenField?(self, didEnterText: text) + delegate?.tokenField?(self, didCompleteText: text) } /// Removes the input text and all displayed tokens. From 081bfc97a9c13ac9b0e69ae127410f71018e74c9 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 4 Feb 2017 15:17:17 +0800 Subject: [PATCH 02/11] Add tokenField(_:shouldCompleteText:) --- Example/CustomizedTokenViewController.swift | 9 ++++-- README.md | 1 + Source/TokenField/ICTokenField.swift | 36 ++++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Example/CustomizedTokenViewController.swift b/Example/CustomizedTokenViewController.swift index d816bcd..8e18ee2 100644 --- a/Example/CustomizedTokenViewController.swift +++ b/Example/CustomizedTokenViewController.swift @@ -83,13 +83,18 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { print(#function) } + func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool { + print("Should add \"\(text)\"?") + return text != "42" + } + func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) { - print("Add: \"\(text)\"") + print("Added \"\(text)\"") updateTexts() } func tokenField(_ tokenField: ICTokenField, didDeleteText text: String, atIndex index: Int) { - print("Delete: \"\(text)\"") + print("Deleted \"\(text)\"") updateTexts() } diff --git a/README.md b/README.md index 3a3acb3..077f56d 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ See `Example/CustomizedTokenField.swift` for more details. * `tokenFieldDidBeginEditing(_:)` * `tokenFieldDidEndEditing(_:)` * `tokenFieldWillReturn(_:)` +* `tokenField(_:shouldCompleteText:)` * `tokenField(_:didCompleteText:)` * `tokenField(_:didDeleteText:atIndex:)` diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 715bb5b..bfd3f9d 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -34,6 +34,8 @@ import UIKit @objc optional func tokenFieldDidEndEditing(_ tokenField: ICTokenField) /// Tells the delegate that the token field will process the pressing of the return button. @objc optional func tokenFieldWillReturn(_ tokenField: ICTokenField) + /// Asks the delegate if the text should become a token in the token field. + @objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool /// Tells the delegate that the text becomes a token in the token field. @objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) /// Tells the delegate that the token at certain index is removed from the token field. @@ -289,21 +291,25 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega let text = (input as NSString).replacingCharacters(in: range, with: string) for delimiter in delimiters { - if text.hasSuffix(delimiter) { - let index = text.index(text.endIndex, offsetBy: -delimiter.characters.count) - let newToken = text.substring(to: index) - textField.text = nil - - if !newToken.isEmpty && newToken != delimiter { - tokens.append(ICToken(text: newToken, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) - layoutTokenTextField() - delegate?.tokenField?(self, didCompleteText: newToken) - } - togglePlaceholderIfNeeded() + guard text.hasSuffix(delimiter) else { + continue + } + + let index = text.index(text.endIndex, offsetBy: -delimiter.characters.count) + let newToken = text.substring(to: index) - return false + if !newToken.isEmpty && newToken != delimiter && (delegate?.tokenField?(self, shouldCompleteText: newToken) ?? true) { + tokens.append(ICToken(text: newToken, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) + layoutTokenTextField() + delegate?.tokenField?(self, didCompleteText: newToken) } + + textField.text = nil + togglePlaceholderIfNeeded() + + return false } + return true } @@ -436,6 +442,12 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega guard let text = inputTextField.text, !text.isEmpty else { return } + + let shouldCompleteText = delegate?.tokenField?(self, shouldCompleteText: text) ?? true + guard shouldCompleteText else { + return + } + inputTextField.text = nil tokens.append(ICToken(text: text, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) layoutTokenTextField() From 296e65f7c759949db4e05ec2c8ab61e71e9970e9 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 4 Feb 2017 16:33:23 +0800 Subject: [PATCH 03/11] Add tokenField(_:didChangeInputText:) --- CHANGELOG.md | 15 +++++++++++++++ Example/CustomizedTokenViewController.swift | 4 ++++ README.md | 1 + Source/TokenField/ICTokenField.swift | 3 +++ 4 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2505371..9d2d242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## v1.4.0 + +* Added delegate methods: + + ```swift +@objc optional func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) +@objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool +``` + +* Changed delegate method: + + ```swift +@objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) +``` + ## v1.3.0 * Swift 3.0 diff --git a/Example/CustomizedTokenViewController.swift b/Example/CustomizedTokenViewController.swift index 8e18ee2..8a9d806 100644 --- a/Example/CustomizedTokenViewController.swift +++ b/Example/CustomizedTokenViewController.swift @@ -83,6 +83,10 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { print(#function) } + func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) { + print("Typing \"\(text)\"") + } + func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool { print("Should add \"\(text)\"?") return text != "42" diff --git a/README.md b/README.md index 077f56d..6bee484 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ See `Example/CustomizedTokenField.swift` for more details. * `tokenFieldDidBeginEditing(_:)` * `tokenFieldDidEndEditing(_:)` * `tokenFieldWillReturn(_:)` +* `tokenField(_:didChangeInputText:)` * `tokenField(_:shouldCompleteText:)` * `tokenField(_:didCompleteText:)` * `tokenField(_:didDeleteText:atIndex:)` diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index bfd3f9d..504e29f 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -34,6 +34,8 @@ import UIKit @objc optional func tokenFieldDidEndEditing(_ tokenField: ICTokenField) /// Tells the delegate that the token field will process the pressing of the return button. @objc optional func tokenFieldWillReturn(_ tokenField: ICTokenField) + /// Tells the delegate the input text is changed. + @objc optional func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) /// Asks the delegate if the text should become a token in the token field. @objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool /// Tells the delegate that the text becomes a token in the token field. @@ -289,6 +291,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega } let text = (input as NSString).replacingCharacters(in: range, with: string) + delegate?.tokenField?(self, didChangeInputText: text) for delimiter in delimiters { guard text.hasSuffix(delimiter) else { From 7cf7f1a8e242c6878ba3c6266f4ed556bee7ee73 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 4 Feb 2017 18:54:17 +0800 Subject: [PATCH 04/11] Update docs on the develop branch --- .travis.yml | 2 ++ scripts/update-docs.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b1bfad3..e7c00b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ script: - bundle exec rake ci:build - make -B carthage - make -B docs +after_script: + - sh scripts/update-docs.sh notifications: email: false slack: diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh index 28a174b..daf0471 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_BRANCH}" = "master" ] && [ -n "$DANGER_GITHUB_API_TOKEN" ]; then +if [ "${TRAVIS_BRANCH}" = "develop" ] && [ -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 From 3297ec814f8b679971d1950853d1d758d6925e09 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 5 Feb 2017 16:15:43 +0800 Subject: [PATCH 05/11] Workaround to trigger didSet inside the initializer --- Source/TokenField/ICToken.swift | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/TokenField/ICToken.swift b/Source/TokenField/ICToken.swift index 10ff293..eb9757c 100644 --- a/Source/TokenField/ICToken.swift +++ b/Source/TokenField/ICToken.swift @@ -94,12 +94,10 @@ class ICToken: UIView { self.init() if let attributes = normalAttributes { normalTextAttributes = attributes } if let attributes = highlightedAttributes { highlightedTextAttributes = attributes } - // didSet is not called within the initializer - setText(text) - } - - private func setText(_ text: String) { - self.text = text + ({ + // Workaround to trigger didSet inside the initializer + self.text = text + })() } // MARK: - Private Methods From 3555d4167bd9e0b71bec9a8935ea382b5396a945 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 5 Feb 2017 16:29:51 +0800 Subject: [PATCH 06/11] Add tokenField(_:subsequentDelimiterForCompletedText:) to display customized delimiter strings --- CHANGELOG.md | 1 + Example/CustomizedTokenViewController.swift | 6 ++++++ README.md | 22 ++++++++++++++------- Source/TokenField/ICToken.swift | 13 ++++++------ Source/TokenField/ICTokenField.swift | 20 ++++++++++++++----- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d2d242..edbfe00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ```swift @objc optional func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) @objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool +@objc optional func tokenField(_ tokenField: ICTokenField, subsequentDelimiterForCompletedText text: String) -> String ``` * Changed delegate method: diff --git a/Example/CustomizedTokenViewController.swift b/Example/CustomizedTokenViewController.swift index 8a9d806..b167724 100644 --- a/Example/CustomizedTokenViewController.swift +++ b/Example/CustomizedTokenViewController.swift @@ -37,6 +37,8 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { override func loadView() { super.loadView() view.backgroundColor = UIColor.white + textView.isEditable = false + textView.isSelectable = false textView.text = "[\n\n]" textView.font = UIFont.preferredFont(forTextStyle: .subheadline) textView.frame = view.bounds.insetBy(dx: 10, dy: 10) @@ -102,6 +104,10 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate { updateTexts() } + func tokenField(_ tokenField: ICTokenField, subsequentDelimiterForCompletedText text: String) -> String { + return " ," + } + // MARK: - UIResponder Callbacks @objc fileprivate func dismiss(_ sender: UIBarButtonItem) { diff --git a/README.md b/README.md index 6bee484..6eecd67 100644 --- a/README.md +++ b/README.md @@ -132,13 +132,21 @@ See `Example/CustomizedTokenField.swift` for more details. `ICTokenField` currently notifies its delegate the following events: -* `tokenFieldDidBeginEditing(_:)` -* `tokenFieldDidEndEditing(_:)` -* `tokenFieldWillReturn(_:)` -* `tokenField(_:didChangeInputText:)` -* `tokenField(_:shouldCompleteText:)` -* `tokenField(_:didCompleteText:)` -* `tokenField(_:didDeleteText:atIndex:)` +```swift +@objc optional func tokenFieldDidBeginEditing(_ tokenField: ICTokenField) +@objc optional func tokenFieldDidEndEditing(_ tokenField: ICTokenField) +@objc optional func tokenFieldWillReturn(_ tokenField: ICTokenField) +@objc optional func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) +@objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool +@objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) +@objc optional func tokenField(_ tokenField: ICTokenField, didDeleteText text: String, atIndex index: Int) +``` + +The displayed delimiter string can be customized by: + +```swift +@objc optional func tokenField(_ tokenField: ICTokenField, subsequentDelimiterForCompletedText text: String) -> String +``` ## Development diff --git a/Source/TokenField/ICToken.swift b/Source/TokenField/ICToken.swift index eb9757c..818092e 100644 --- a/Source/TokenField/ICToken.swift +++ b/Source/TokenField/ICToken.swift @@ -63,10 +63,10 @@ class ICToken: UIView { // MARK: - Private Properties private(set) lazy var delimiterLabel: UILabel = { - let _delimiter = UILabel() - _delimiter.text = " , " - _delimiter.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor - return _delimiter + let _label = UILabel() + _label.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor + _label.textAlignment = .right + return _label }() private(set) lazy var textLabel: UILabel = { @@ -90,10 +90,11 @@ class ICToken: UIView { setUpSubviews() } - convenience init(text: String, normalAttributes: [String: NSObject]? = nil, highlightedAttributes: [String: NSObject]? = nil) { + convenience init(text: String, delimiter: String = ",", normalAttributes: [String: NSObject]? = nil, highlightedAttributes: [String: NSObject]? = nil) { self.init() if let attributes = normalAttributes { normalTextAttributes = attributes } if let attributes = highlightedAttributes { highlightedTextAttributes = attributes } + delimiterLabel.text = delimiter ({ // Workaround to trigger didSet inside the initializer self.text = text @@ -125,7 +126,7 @@ class ICToken: UIView { "text": textLabel, "delimiter": delimiterLabel ] - addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[text][delimiter]|", + addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[text][delimiter]-5-|", options: [.alignAllCenterY], metrics: nil, views: views diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 504e29f..5a3eef5 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -42,6 +42,8 @@ import UIKit @objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) /// Tells the delegate that the token at certain index is removed from the token field. @objc optional func tokenField(_ tokenField: ICTokenField, didDeleteText text: String, atIndex index: Int) + /// Asks the delegate for the subsequent delimiter string for a completed text in the token field. + @objc optional func tokenField(_ tokenField: ICTokenField, subsequentDelimiterForCompletedText text: String) -> String } @@ -299,12 +301,12 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega } let index = text.index(text.endIndex, offsetBy: -delimiter.characters.count) - let newToken = text.substring(to: index) + let newText = text.substring(to: index) - if !newToken.isEmpty && newToken != delimiter && (delegate?.tokenField?(self, shouldCompleteText: newToken) ?? true) { - tokens.append(ICToken(text: newToken, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) + if !newText.isEmpty && newText != delimiter && (delegate?.tokenField?(self, shouldCompleteText: newText) ?? true) { + tokens.append(customizedToken(with: newText)) layoutTokenTextField() - delegate?.tokenField?(self, didCompleteText: newToken) + delegate?.tokenField?(self, didCompleteText: newText) } textField.text = nil @@ -373,6 +375,14 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega // MARK: - Private Methods + private func customizedToken(with text: String) -> ICToken { + if let string = delegate?.tokenField?(self, subsequentDelimiterForCompletedText: text) { + return ICToken(text: text, delimiter: string, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes) + } else { + return ICToken(text: text, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes) + } + } + /// Returns true if any highlighted token is found and removed, otherwise false. private func removeHighlightedToken() -> Bool { for (index, token) in tokens.enumerated() { @@ -452,7 +462,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega } inputTextField.text = nil - tokens.append(ICToken(text: text, normalAttributes: normalTokenAttributes, highlightedAttributes: highlightedTokenAttributes)) + tokens.append(customizedToken(with: text)) layoutTokenTextField() delegate?.tokenField?(self, didCompleteText: text) } From d8c846e16f7075605eebe1b72b150e5e5c5bc4c3 Mon Sep 17 00:00:00 2001 From: woogii Date: Wed, 1 Mar 2017 20:18:28 +0900 Subject: [PATCH 07/11] Fix typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6eecd67..e909c96 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,10 @@ let tokenField = ICTokenField(frame: rect) tokenField.delegate = self as? ICTokenFieldDelegate ``` -* The characters that completes a token: +* The characters that complete a token: ```swift -/// Characters that completes a new token, defaults are whitespace and commas. +/// Characters that complete a new token, defaults are whitespace and commas. public var delimiters: [String] ``` @@ -150,7 +150,7 @@ The displayed delimiter string can be customized by: ## Development -* Meke sure [Homebrew](http://brew.sh/) is installed. +* Make 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: From 93927e3bdcff4f26b709f0be59da2fa39006c1ec Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 29 Mar 2017 22:34:02 +0800 Subject: [PATCH 08/11] Fix markdown code blocks --- CHANGELOG.md | 14 +++++++------- README.md | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edbfe00..61c0c79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,16 +3,16 @@ * Added delegate methods: ```swift -@objc optional func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) -@objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool -@objc optional func tokenField(_ tokenField: ICTokenField, subsequentDelimiterForCompletedText text: String) -> String -``` + @objc optional func tokenField(_ tokenField: ICTokenField, didChangeInputText text: String) + @objc optional func tokenField(_ tokenField: ICTokenField, shouldCompleteText text: String) -> Bool + @objc optional func tokenField(_ tokenField: ICTokenField, subsequentDelimiterForCompletedText text: String) -> String + ``` -* Changed delegate method: +* Renamed delegate method: ```swift -@objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) -``` + @objc optional func tokenField(_ tokenField: ICTokenField, didCompleteText text: String) + ``` ## v1.3.0 diff --git a/README.md b/README.md index e909c96..e2ff033 100644 --- a/README.md +++ b/README.md @@ -155,16 +155,16 @@ The displayed delimiter string can be customized by: * Set up dependencies by running the following command in the project root: ``` -make setup -``` + make setup + ``` * Open **ICInputAccessory.xcworkspace** and run the demo app with the `Example` scheme. * See more tasks for building and testing: ``` -rake -T -``` + rake -T + ``` ## Contributing From 1218602a20b48c572c5387df336447448e48187a Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 29 Mar 2017 22:40:10 +0800 Subject: [PATCH 09/11] Rename make bootstrap --- Makefile | 6 ++++-- README.md | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8b63836..bd5efb9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ install: brew-install bundle-install pod-install brew-install: - brew update brew tap homebrew/bundle brew bundle @@ -11,7 +10,10 @@ bundle-install: pod-install: bundle exec pod install --no-repo-update -setup: brew-install +bootstrap: + brew tap homebrew/bundle + brew bundle + gem install bundler bundle install bundle exec pod install --no-repo-update diff --git a/README.md b/README.md index e2ff033..42be5f2 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ The displayed delimiter string can be customized by: * Set up dependencies by running the following command in the project root: ``` - make setup + make bootstrap ``` * Open **ICInputAccessory.xcworkspace** and run the demo app with the `Example` scheme. From 567c63393dced0d90095236e3ec5cd6d51a5edcb Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 29 Mar 2017 22:41:11 +0800 Subject: [PATCH 10/11] Bump version to 1.4.0 --- .jazzy.yml | 2 +- Example/Info.plist | 2 +- ICInputAccessory.podspec | 2 +- ICInputAccessory/Info.plist | 2 +- ICInputAccessoryUITests/Info.plist | 2 +- Podfile.lock | 6 +++--- README.md | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.jazzy.yml b/.jazzy.yml index 465c756..ab755d1 100644 --- a/.jazzy.yml +++ b/.jazzy.yml @@ -5,6 +5,6 @@ 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.3.0 +module_version: 1.4.0 output: docs/output theme: fullwidth diff --git a/Example/Info.plist b/Example/Info.plist index eee55eb..4a13d88 100644 --- a/Example/Info.plist +++ b/Example/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.3.0 + 1.4.0 CFBundleSignature ???? CFBundleVersion diff --git a/ICInputAccessory.podspec b/ICInputAccessory.podspec index f5a705d..cfbbaf8 100644 --- a/ICInputAccessory.podspec +++ b/ICInputAccessory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ICInputAccessory" - s.version = "1.3.0" + s.version = "1.4.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 9f4a4aa..8bce5c7 100644 --- a/ICInputAccessory/Info.plist +++ b/ICInputAccessory/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.3.0 + 1.4.0 CFBundleSignature ???? CFBundleVersion diff --git a/ICInputAccessoryUITests/Info.plist b/ICInputAccessoryUITests/Info.plist index 3fee538..c48e13f 100644 --- a/ICInputAccessoryUITests/Info.plist +++ b/ICInputAccessoryUITests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.3.0 + 1.4.0 CFBundleSignature ???? CFBundleVersion diff --git a/Podfile.lock b/Podfile.lock index 4f47d31..12d3a56 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,6 +1,6 @@ PODS: - - ICInputAccessory/KeyboardDismissTextField (1.3.0) - - ICInputAccessory/TokenField (1.3.0) + - ICInputAccessory/KeyboardDismissTextField (1.4.0) + - ICInputAccessory/TokenField (1.4.0) DEPENDENCIES: - ICInputAccessory/KeyboardDismissTextField (from `./`) @@ -11,7 +11,7 @@ EXTERNAL SOURCES: :path: "./" SPEC CHECKSUMS: - ICInputAccessory: e9142958152461ddb627e78e3f1f0a8b263b7271 + ICInputAccessory: dace41bea1ed8b0368bf8ffd439a215efa8effd3 PODFILE CHECKSUM: 6e8fb9f23fc92d92278fbf08ca8ef072ef28a486 diff --git a/README.md b/README.md index 42be5f2..887331f 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) -[![CocoaDocs](https://img.shields.io/cocoapods/metrics/doc-percent/ICInputAccessory.svg)](http://cocoadocs.org/docsets/ICInputAccessory/) +[![CocoaDocs](https://img.shields.io/cocoapods/metrics/doc-percent/ICInputAccessory.svg)](https://polydice.github.io/ICInputAccessory) ![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg) ### ICKeyboardDismissTextField @@ -30,7 +30,7 @@ ICInputAccessory | iOS | Xcode | Swift `~> 1.0.0` | 8.0+ | 7.2 | ![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg) `~> 1.1.0` | 8.0+ | 7.3 | ![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg) `~> 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.3.0` | 8.0+ | 8.0 | ![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg) ## Installation From 207327bf252761b59ee312fac1efe945c0c9ff9f Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 29 Mar 2017 23:15:55 +0800 Subject: [PATCH 11/11] Mark the ICBackspaceTextFieldDelegate method as nonobjc to silence the warning > instance method 'textFieldShouldDelete' nearly matches optional requirement 'textFieldShouldClear' of protocol 'UITextFieldDelegate' --- 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 5a3eef5..4108f75 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -327,7 +327,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega // MARK: - ICBackspaceTextFieldDelegate - func textFieldShouldDelete(_ textField: ICBackspaceTextField) -> Bool { + @nonobjc func textFieldShouldDelete(_ textField: ICBackspaceTextField) -> Bool { if tokens.isEmpty { return true }