Structure

OpenURLAction.Result

The result of a custom open URL action.

Declaration 宣言

struct Result

Overview 概要

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"))
})

Topics 話題

Type Properties 型プロパティ

Type Methods 型メソッド

See Also 参照

Creating the Action