leading edge for VStack in SwiftUI
I want to create a VStack of many Texts with 20 points of spacing between each Text. I want my VStack to be aligned to left side of the screen(or leading side of parent View).
Try this:
struct ContentView: View {
var body: some View {
HStack(){
//alignment options: .center , .leading , .trailing
VStack(alignment: .leading, spacing: 20){
Text("Salam")
Text("chetori")
Text("Arsalan")
Text("?")
}
Spacer()
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
and if you want your VStack to be on right side of your screen, put the Spacer above the VStack