I am trying to build a VStack (container) containing multiple VStacks (element) with each a title and a text. The element VStacks should be distributed equally and have a spacer in between.
For some reason it only works up to 4 element VStack and if I increase then I will get an error
Failed to build ContentView.swift
Ambiguous reference to member 'buildingBlock()'
Here is my code:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Spacer()
VStack {
Text("Title 1")
Text("Text 1")
}
Spacer()
VStack {
Text("Title 2")
Text("Text 2")
}
Spacer()
VStack {
Text("Title 3")
Text("Text 3")
}
Spacer()
VStack {
Text("Title 4")
Text("Text 4")
}
Spacer()
VStack {
Text("Title 5")
Text("Text 5")
}
Spacer()
VStack {
Text("Title 6")
Text("Text 6")
}
Spacer()
VStack {
Text("Title 7")
Text("Text 7")
}
Spacer()
VStack {
Text("Title 8")
Text("Text 8")
}
Spacer()
VStack {
Text("Title 9")
Text("Text 9")
}
Spacer()
VStack {
Text("Title 10")
Text("Text 10")
}
Spacer()'
}
.background(Color.red)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}