One Logo Pool Ball
AppIntents · IOS API REFERENCE

IntentURLRepresentation

struct · iOS 18.0+ · SDK 27.1

struct IntentURLRepresentation<Intent> where Intent : AppIntent

The type that provides the URL for an app intent. If you adopt the ``URLRepresentableIntent`` protocol in an app intent, use this type to build the URL for your app intent. Construct the type as a Swift string that contains characters suitable for use in a URL. To incorporate content from your app intent's parameters into the URL, include a key path to the parameter in your string. The following example provides the URL for a specific page of a website. Before returning the URL, this type replaces the `\(\.$page)` key path with the value in the `page` parameter. ```swift struct OpenAppleDotCom: URLRepresentableIntent { static var urlRepresentation: URLRepresentation = "https://www.apple.com/\(\.$page)" @Parameter(title: "Page") var page: String static var title: LocalizedStringResource = "Open Apple website" } ``` Make sure the parameters you include in your URL representation contain a URL-friendly type. The system automatically converts parameters of type <doc://com.apple.documentation/documentation/swift/string>, <doc://com.apple.documentation/documentation/swift/int>, and <doc://com.apple.documentation/documentation/Foundation/URL> to values suitable for inclusion in a URL. To incorporate other types, implement the ``CustomURLRepresentationParameterConvertible`` protocol in the type.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

IntentURLRepresentation.init(_:)

The containing type needs Swift generic type arguments. (no canonical witness for Intent)

IntentURLRepresentation.init(stringLiteral:)

The containing type needs Swift generic type arguments. (no canonical witness for Intent)

IntentURLRepresentation.init(stringInterpolation:)

The containing type needs Swift generic type arguments. (no canonical witness for Intent)

All AppIntents types →