The biggest pro to this approach is you are able to break out the highlightable elements and use protocol extensions to provide a default highlighting implementation.
The boilerplate for the elements that conform to Highlightable would have been reduced greatly if UITextView didn't use IUOs for its text/attributedText properties :(
The only API change this introduces is the removal of the HighlighterType enum. Instead you just pass in the type of the item you are targeting i.e. UIButton.self for buttons or nil for everything.
Hey, Interesting lib
I had a quick play at a protocol oriented version if you are interested
https://gist.github.com/IanKeen/537d70bf02fad763c096e6fbb5c1dc69
The biggest pro to this approach is you are able to break out the highlightable elements and use protocol extensions to provide a default highlighting implementation.
The boilerplate for the elements that conform to
Highlightable
would have been reduced greatly ifUITextView
didn't use IUOs for its text/attributedText properties :(The only API change this introduces is the removal of the
HighlighterType
enum. Instead you just pass in the type of the item you are targeting i.e.UIButton.self
for buttons ornil
for everything.Let me know if you'd be interested in a PR