Padding between Navigation Links in a Form, in Swift UI

338 views Asked by At

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

1

There are 1 answers

1
davidev On BEST ANSWER

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")
        }
    }
}