Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't displayed attributed text in the default initializer #10

Open
jderbs opened this issue Apr 6, 2021 · 3 comments
Open

Can't displayed attributed text in the default initializer #10

jderbs opened this issue Apr 6, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@jderbs
Copy link

jderbs commented Apr 6, 2021

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.

@loryhuz loryhuz added the enhancement New feature or request label Apr 7, 2021
@loryhuz
Copy link
Owner

loryhuz commented Apr 7, 2021

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

@jderbs
Copy link
Author

jderbs commented Apr 7, 2021

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

Aussi, je parle français 😎

@jderbs
Copy link
Author

jderbs commented Apr 9, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants