由于 SwiftUI 是声明性的,因此没有 dismiss
方法。
如何在 DetailView
中添加解除/关闭按钮?
struct DetailView: View {
var body: some View {
Text("Detail")
}
}
struct ContentView : View {
var body: some View {
PresentationButton(Text("Click to show"), destination: DetailView())
}
}