Discussion 議論
Don’t call this method directly. SwiftUI calls it for you when you call the Dismiss
structure that you get from the Environment
:
private struct SheetContents: View {
private var dismiss (\.dismiss)
var body: some View {
Button("Done") {
dismiss() // Implicitly calls dismiss.callAsFunction()
}
}
}
For information about how Swift uses the call
method to simplify call site syntax, see Methods with Special Names in The Swift Programming Language.