Using a Picker in a Form inside an Sheet does not work

Hi. I need to use a picker in a form inside a sheet. But this does not work. If I click on the picker I get not into the selection of the Elements.

Any suggestions here?
This works for me (picker in a form in a sheet):
Code Block Swift
struct ContentView: View {
@State private var showingSheet = false
var body: some View {
Text("Click me")
.onTapGesture {
showingSheet = true
}
.sheet(isPresented: $showingSheet, content: ModalView.init)
}
}
struct ModalView: View {
@Environment(\.presentationMode) var presentationMode
@State private var selection = 0
let data = ["One", "Two", "Three", "Four"]
var body: some View {
NavigationView {
Form {
Picker("Choose a number", selection: $selection) {
ForEach(0 ..< data.count, id: \.self) { index in
Text(data[index])
}
}
}
.toolbar {
Button("Done") {
presentationMode.wrappedValue.dismiss()
}
}
}
}
}

Inside the Picker body make sure it is ForEach(0 ..< data.count, ... not ForEach(data, ... because that won't work. Maybe that's what you have done wrong.
Also make sure your Form is wrapped inside of a NavigationView.

It would have been helpful to see your code for this.

Using a Picker in a Form inside an Sheet does not work
 
 
Q