I can't seem to find any information on this, anywhere. So I'm learning SwiftUI, and I'm trying to add a Picker to a Form, but the picker won't display the available options when tapped. I don't really know what else to tell you guys so could someone take a look and help me fix this? thanks :)
//Outside the body code
@State var contacts: [String] = [""]
@State var types: [Type] = [.mobile]
//Inside the body code and inside a Form{}
Section(header: Text("Contact")){
ForEach(0..<types.count, id: \.self) { i in
HStack{
Picker(selection: $types[i], label: Text(""), content: {
Text("Mobile").tag(Type.mobile)
Text("Land Line").tag(Type.landline)
Text("Email").tag(Type.email)
}).pickerStyle(DefaultPickerStyle())
.frame(width: 80.0)
TextField("Insert Detail", text: $contacts[i])
}
}
Button("Add Another") {
types.append(.mobile)
contacts.append("")
}