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?
Any suggestions here?
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() } } } } }