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 SearchedView: View {
private var dismissSearch (\.dismissSearch)
var body: some View {
Button("Cancel") {
dismissSearch() // Implicitly calls dismissSearch.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.