0

I want to setup a form in SwiftUI and I want to make a spacing between two Navigation Links in a Form. Like thisThis is the spacing I mean

I have no Idea how to do this (I have tried it with .padding, two different forms use.) Thanks Boothosh

4

1 回答 1

1

These are Sections inside a Form. No need for padding, just use default spacing with Sections. Here is an example

struct ContentView: View {
    @State var username: String = ""
    @State var password: String = ""
    
    var body: some View {
        NavigationView {
            Form {
                Section {
                    TextField("Username", text: $username)
                }
                Section {
                    TextField("Password", text: $password)
                }
            }
            .navigationBarTitle("Settings")
        }
    }
}
于 2021-03-02T14:20:40.103 回答