Post

Replies

Boosts

Views

Activity

Select an object in Picker NavigationStyle
Hello everybody, I have a problem with the Picker in SwiftUI. I try to create a Picker in a Form with NavigationStyle: Picker("Member", selection: $member) { Text("None") .tag(nil as Member?) ForEach(members) { member in Text(member.fullName) .tag(member as Member?) } } .pickerStyle(.navigationLink) But if I am selecting an object oder None, nothing change. I try the same code with PickerStyle .inline and the Code work a aspected: Picker("Member", selection: $member) { Text("None") .tag(nil as Member?) ForEach(members) { member in Text(member.fullName) .tag(member as Member?) } } .pickerStyle(.inline) I also try the same code with String (not with Member) and this works fine. I'm a bit confused because it doesn't work in PickerStyle NavigationLink only. Can you help me or is it a bug? More code: @Query(sort: \Member.givenName) private var members: [Member] @State private var member: Member? = nil Thanks a lot
1
0
535
Oct ’23