How to align Text in SwiftUI?

To align Text in iOS Application with .leading .trailing .center of Text use .multilineTextAlignment(.

struct ContentView: View {
    var body: some View {
        Text("A demo long text A demo long textA demo long textA demo long textA demo long textA demo long textA demo long textA demo long textA demo long textA demo long textA demo long text")
            .multilineTextAlignment(.leading)
            .padding(25)
    }
}

Leave a Comment

Your email address will not be published. Required fields are marked *