psharanda / Atributika

Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.
MIT License
1.45k stars 155 forks source link

Why onClick only when style contains any attributes for .highlighted? #120

Closed rivera-ernesto closed 1 year ago

rivera-ernesto commented 4 years ago

I think we shouldn't ask for .highlighted attributes fo this. Instead it could all be handled in theonClick configuration block.

rivera-ernesto commented 4 years ago

After actually using it, it now makes more sense 🤪

psharanda commented 4 years ago

Yeah API is not perfect. But haven't been able to find anything better.

psharanda commented 4 years ago

Actually, what if add modifier like this: let a = Style("a").userInteractionEnabled(true).foregroundColor(.blue) So there is no need to define something special to make text clickable

psharanda commented 4 years ago

I am also thinking about macOS, in addition to highlighted, text can have hovered state

rivera-ernesto commented 4 years ago

Those sound like nice improvements! Maybe .tapEnabled() (or click) is a better name. Same for hovering.

psharanda commented 4 years ago

userInteractionEnabled is more universal across platforms. Actually I just realized that there is no support for AttributedLabel on macOS :)

psharanda commented 1 year ago

This was reworked in V5. Closing this as obsolete