<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/IntentURLRepresentation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents23IntentURLRepresentationV"
  },
  "title" : "IntentURLRepresentation"
}
-->

# IntentURLRepresentation

The type that provides the URL for an app intent.

```
struct IntentURLRepresentation<Intent> where Intent : AppIntent
```

## Overview

If you adopt the [`URLRepresentableIntent`](/documentation/AppIntents/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`](/documentation/AppIntents/CustomURLRepresentationParameterConvertible) protocol in the type.

## Topics

### Initializers

[`init(String)`](/documentation/AppIntents/IntentURLRepresentation/init(_:))

Creates a URL representation for an app intent using the provided Swift string.

## Relationships

### Conforms To

[`ExpressibleByStringInterpolation`](/documentation/Swift/ExpressibleByStringInterpolation)

[`ExpressibleByExtendedGraphemeClusterLiteral`](/documentation/Swift/ExpressibleByExtendedGraphemeClusterLiteral)

[`ExpressibleByUnicodeScalarLiteral`](/documentation/Swift/ExpressibleByUnicodeScalarLiteral)

[`ExpressibleByStringLiteral`](/documentation/Swift/ExpressibleByStringLiteral)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)