Avatar ·

Text alignment in SwiftUI: how to align left, center, and right?

Hi! I'm new to SwiftUI and can't figure out how to align text. In UIKit I used `NSTextAlignment`, but in SwiftUI it's different. I have a simple screen with text, but it always aligns to the center, even when I try to make it left-aligned. Here's my code: ```swift struct ContentView: View { var body: some View { VStack { Text("Hello, world!") .font(.title) .frame(width: 300, height: 100) .background(Color.gray.opacity(0.2)) Text("This is a long text that should be left-aligned, but it stays centered for some reason. I tried adding .multilineTextAlignment(.leading), but it doesn't help.") .frame(width: 300) ```