In this code, the edit button presents the modal window as expected. On dismissal, the interface does not accept further input. In other words it only works once. Is this another bug in SwiftUI?
import SwiftUI
struct ContentView: View {
@State var showModal:Bool = false
var body: some View {
NavigationView{
Text("Sample")
.navigationBarTitle("List")
.navigationBarItems(leading:Button("Edit"){
self.showModal = true
})
}.sheet(isPresented: self.$showModal) {
Modal(isOn: self.$showModal)
}
}
}
struct Modal: View {
@Binding var isOn:Bool
var body: some View {
Text("Dismiss Modal View").onTapGesture {
self.isOn = false
}
}
}