Ios – SwiftUI text-alignment

iosswiftswiftui

Among the many properties of the Text view, I couldn't find any related to text alignment. I've seen in a demo that it automatically handles RTL, and when placing stuff using View's body, it always centers it automatically.

Is there some concept that I'm missing about layout system in SwiftUI and if not, how can I set the text alignment properties to the Text?

Best Answer

You can do this via the modifier .multilineTextAlignment(.center).

Apple Documentation

Related Topic