Timmerz
Timmerz

Reputation: 6199

SwiftUI Form Bug

I'm using SwiftUI and Form and somehow the form doesn't look like any examples. Instead it has margins and corner radiuses...I don't like this style. Is this a bug, or a new direction from Apple?

I'm using XCode 12 Beta 4

struct LoginView: View {
@State private var email = ""
@State private var password = ""

var body: some View {
    NavigationView {
        Form {
            Section {
                TextField("Email", text: self.$email)
                
                SecureField("Password", text: self.$password)
            }
            
            Button(action: login) {
                Text("LOGIN")
            }
        }.navigationBarTitle("Login")
    }
}

func login() {
    let api = API()
    
    api.login(username: self.email, password: self.password) {
        ticket in
        print(ticket)
    }
}

enter image description here

This is what I want:

enter image description here

Upvotes: 1

Views: 513

Answers (1)

Timmerz
Timmerz

Reputation: 6199

I was able to finally get around this by changing Form to List and adding a modifier:

List {
    Section { }
}
.listStyle(GroupedListStyle())

Upvotes: 2

Related Questions