In SwiftUI
I discovered the Alert
type. But I wonder how to show it with the presentation
method.
Initializing an Alert
is pretty easy. But how to use the binding?
struct ContentView : View {
var body: some View {
Button(action: {
// Don't know how to use the `binding` below
presentation(binding, alert: {
Alert(title: Text("Hello"))
})
}, label: {
Text("asdf")
})
}
}
The binding is of type Binding<Bool>