I would like to left-aligned the message
in Alert:
Alert(title: Text, message: Text? = nil, dismissButton: Alert.Button? = nil)
However, since message
is type Text?
, the following didn’t work due to it is type of some View
:
Text(xx).multilineAlignment(.leading)
Text(xx).frame(alignment: .leading)
VStack(alignment: .leading) {...}
Compiler doesn’t like above.
- if I add "
Text(xx).frame(alignment: .leading) as? Text
", it
compiles, but msg become nil - if I add "
Text(xx).frame(alignment: .leading) as! Text
", it compiles, but crash in runtime
Any Idea how I can left-aligned Alert message?
Thank you very much in advance