I've been building an application in SwiftUI recently and today I'm noticing that the VStack Alignment is having some strange behavior. No matter the alignment I use, the view isn't aligning outside of the center. See below:
VStack(alignment: .trailing, spacing: 0) {
Text("Hello, World!")
}
VStack(alignment: .center, spacing: 0) {
Text("Hello, World!")
}
It's doing this in both the preview and the simulator, I'm trying to align my text to the right edge of the screen.
Full Code:
import SwiftUI
struct DemoView: View {
var body: some View {
VStack(alignment: .center, spacing: 0) {
Text("Hello, World!")
}
}
}
struct DemoView_Previews: PreviewProvider {
static var previews: some View {
DemoView()
}
}