Rightpoint / BonMot

Beautiful, easy attributed strings in Swift
MIT License
3.54k stars 197 forks source link

Styling texts from Storyboards #308

Closed amaurydavid closed 6 years ago

amaurydavid commented 6 years ago

I'm trying to use BonMot with existing storyboards but I'm struggling to apply text styles correctly.

Until now, labels in my storyboards were styled without BonMot, i.e by setting some plain text in the storyboard, and selecting the correct font family and font size for every UILabel (and UITextField, UITextView, UIButton). Now that I've created some StringStyles and registered them, I'm setting the bonMotStyleName in the attributes's inspector, but the text isn't still styled correctly. What I can do though is to set the text programmatically using the styledText property, but I want to keep those strings in storyboard.

Is there something I'm missing? If not, maybe making the styledText property an IBInspectable would allow the behavior I need?

ZevEisenberg commented 6 years ago

I'm guessing, since you closed this, that you figured it out? What was it? Feel free to open a new issue if you have any more questions :)

amaurydavid commented 6 years ago

I just hoped noone will notice it :p Its just the kind of issue you resolve right after posting it. In my case, the behavior wasn't the one I expected because label's text was overriden programmatically by exactly the same text as in the storyboard ... 🤦‍♂️ Now I still have hard time determining how to use textColors outside of StringStyles, but it's another topic.

ZevEisenberg commented 6 years ago

Classic self-sabotage bug 😜

What do you mean about using textColors outside of StringStyles? Anything I can help with?