Why is the default alignment of a SwiftUI List so wacky? How do I get the text to left align?
My current code:
NavigationStack {
List {
ForEach(users) { user in
VStack {
Text(user.name)
.font(.headline)
Text(user.description)
}
}
}
.navigationTitle("Profiles")
}
It's because of the VStack
alignment, not the List
. The default value is .center
:
@inlinable public init(alignment: HorizontalAlignment = .center, spacing: CGFloat? = nil, @ViewBuilder content: () -> Content)
VStack(alignment: .leading) {
...
}