Atributika icon indicating copy to clipboard operation
Atributika copied to clipboard

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

Open rivera-ernesto opened this issue 4 years ago • 6 comments

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

rivera-ernesto avatar May 18 '20 22:05 rivera-ernesto

After actually using it, it now makes more sense 🤪

rivera-ernesto avatar May 19 '20 13:05 rivera-ernesto

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

psharanda avatar May 19 '20 13:05 psharanda

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 avatar May 19 '20 13:05 psharanda

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

psharanda avatar May 19 '20 13:05 psharanda

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

rivera-ernesto avatar May 20 '20 14:05 rivera-ernesto

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

psharanda avatar May 20 '20 14:05 psharanda

This was reworked in V5. Closing this as obsolete

psharanda avatar Jun 04 '23 10:06 psharanda