The result of a custom open URL action.
If you declare a custom ``OpenURLAction`` in the ``Environment``,
return one of the result values from its handler.
* Use ``handled`` to indicate that the handler opened the URL.
* Use ``discarded`` to indicate that the handler discarded the URL.
* Use ``systemAction`` without an argument to ask SwiftUI
to open the URL with the system handler.
* Use ``systemAction(_:)`` with a URL argument to ask SwiftUI
to open the specified URL with the system handler.
You can use the last option to transform URLs, while
still relying on the system to open the URL. For example,
you could append a path component to every URL:
.environment(\.openURL, OpenURLAction { url in
.systemAction(url.appendingPathComponent("edit"))
})
Members (5)
get · iOS 15.0+
systemAction
TypeScript
static get systemAction(): Promise<OpenURLAction_Result>
Swift declaration
static let systemAction: OpenURLAction.Result
The handler asks the system to open the original URL.
The action invokes its completion handler with a value that
depends on the outcome of the system's attempt to open the URL.
The handler asks the system to open the modified URL.
The action invokes its completion handler with a value that
depends on the outcome of the system's attempt to open the URL.
- Parameter url: The URL that the handler asks the system to open.
get · iOS 15.0+
handled
TypeScript
static get handled(): Promise<OpenURLAction_Result>
Swift declaration
static let handled: OpenURLAction.Result
The handler opened the URL.
The action invokes its completion handler with `true` when your
handler returns this value.
get · iOS 15.0+
discarded
TypeScript
static get discarded(): Promise<OpenURLAction_Result>
Swift declaration
static let discarded: OpenURLAction.Result
The handler discarded the URL.
The action invokes its completion handler with `false` when your
handler returns this value.