由于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())
}
}
Run Code Online (Sandbox Code Playgroud)