im trying to create a form that would resemble something like this:
This one is made in bootstrap and thats quite easy, but now i'm learning some Swift UI and the most i got is:
I've tried using VStacks, ZStacks, HStacks, but it doesn't seem to be working as i expected, maybe i'm using them wrong. I need to somehow create a form similar to the one made in boostrap
The SwiftUI Code:
struct FontsGroup: View {
@State var username: String = ""
@State var isPrivate: Bool = true
var body: some View {
ZStack{
VStack{
HStack(
alignment: .top,
spacing: 0
) {
Form{
Section(header:
HStack {
Text("Nurašoma Prekė")
Image(systemName: "staroflife.fill").foregroundColor(.red)
}
) {
TextField("Username", text: $username)
Toggle(isOn: $isPrivate) {
Text("Private Account")
}
}
}.listRowInsets(EdgeInsets())
Form{
Section(header:
HStack {
Text("Nurašymo priežastis")
Image(systemName: "staroflife.fill").foregroundColor(.red)
}
) {
TextField("Username", text: $username)
Toggle(isOn: $isPrivate) {
Text("Private Account")
}
}
}.listRowInsets(EdgeInsets())
}
HStack(
alignment: .top,
spacing: 0
) {
Form{
Section(header:
HStack {
Text("Nurašoma Prekė")
Image(systemName: "staroflife.fill").foregroundColor(.red)
}
) {
TextField("Username", text: $username)
Toggle(isOn: $isPrivate) {
Text("Private Account")
}
}
}
Form{
Section(header:
HStack {
Text("Nurašymo priežastis")
Image(systemName: "staroflife.fill").foregroundColor(.red)
}
) {
TextField("Username", text: $username)
Toggle(isOn: $isPrivate) {
Text("Private Account")
}
}
}
}
}.padding()
}
}
}
My goal is to have a View with multiple inputs (Best would be 2 columns and as many rows as i need)
Also, i see, that by using these Stacks i make each element scrollable? Is it also to avoid that? Thanks in advance!