CleanyModal icon indicating copy to clipboard operation
CleanyModal copied to clipboard

Can't displayed attributed text in the default initializer

Open jderbs opened this issue 3 years ago • 3 comments

How would one implement the message label on the main alert to be attributed text? I tried changing the default init to be of ‘NSAttributedString’, but I didn’t know how to change it in the file AlertModel, because when I changed message to be of type NSAttributedString, I got an error that I couldn’t fix.

jderbs avatar Apr 06 '21 23:04 jderbs

Yes actually you can't use an attributed string in the default model.

I will keep the model simple, but open visibility of message and title label (they are private variables) so you could pass attributed strings on them

loryhuz avatar Apr 07 '21 10:04 loryhuz

So I should try to access the textfield in the label directly?

Aussi, je parle français 😎

jderbs avatar Apr 07 '21 17:04 jderbs

Nevermind, I ended up creating a similar AlertModel class that didn't use Codable and is just a regular struct. I replaced all the instances of datasource with my own AlertModel instance and changed the labels to attributed text.

When Lory doesn't respond so you do it yourself: image

jderbs avatar Apr 09 '21 01:04 jderbs