Add toggle for multiple select and removable tags#108
Open
michaeltheshah wants to merge 1 commit into
Open
Conversation
Member
|
@mochat97 Nice one, thank you. I'll test this and review it shortly. Exciting! |
ricardopereira
requested changes
Feb 14, 2019
| addTag(tag) | ||
| if let tagView = tagViews.last, autoSelectTagWhenAdded { | ||
| //There's a bug that causes the text to be truncated during animation ("New York" becomes "New Y..."). This delays animating the TagView until after it's set in the TextField. | ||
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { |
Member
There was a problem hiding this comment.
Hmm, I think we should do another approach. This could not always solve the problem.
| } | ||
|
|
||
| open func setRemovable(tags: [String], removable: Bool = false) { | ||
| assert(tagViews.count > 0, "There are no tagViews. Did you call this method after adding tags?") |
Member
There was a problem hiding this comment.
Please try to find another way avoiding the use of asserts. This is quite unsafe in runtime.
| } | ||
|
|
||
| class BackspaceDetectingTextField: UITextField { | ||
| open class BackspaceDetectingTextField: UITextField { |
Member
There was a problem hiding this comment.
This should not be open, we don't want to expose this to lib users.
Member
|
Please provide a functional code in the Example app. Thank you for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request addresses issue #100. It adds a boolean toggle named
allowMultipleSelectionthat allows a user to select multiple tags at once.Also, a boolean toggle named
removableis added that doesn't allow a tag to be removed. This is insideWSTagViewand set with a setter namedsetRemovable(tags: [String], removable: Bool = false). This method will throw an exception if called before any tags are added.Finally, a helper function is created named
getSelectedTagStrings()that gets all tags as a list of strings.