TOMSSuggestionBar
TOMSSuggestionBar copied to clipboard
Support UITextViews
TOMSSuggestionBar doesn't work with UITextViews at the moment because it works with any UIControl <UITextInput>, which UITextView is not. In fact, UITextView is a subclass of UIScrollView <UITextInput>.
Problem: the suggestion bar normally observes the UIControlEventEditingChanged event, which is only officially emitted by UIControl subclasses. Yet we want TOMSSuggestionBar to support all sorts of controls, like
UISearchBarUITextViewUITextField
Looking at the class hierarchy their common superclass is UIResponder — this is too high up for UIControl behaviours.
~~Possible Solution: use https://github.com/andrewsardone/UITextView-UIControl~~
I agree, that would be nice!
What do you mean by solution? Do you mean like UITextView+UIControl should be added as dependency to the project?
Hmm...
Yes — UITextView+UIControl it works brilliantly — from TOMSuggestionBar's perspective we may need to handle UITextView as a special case, and check for the availability addTarget:action: with respondsToSelector: or something horrible like that.
There's no level of abstraction where UITextView fits in neatly, basically. :(