EnumURLRepresentation
struct · iOS 18.0+ · SDK 27.1
struct EnumURLRepresentation<Enum> where Enum : AppEnumThe type that provides the URL for an app enum. If you adopt the ``URLRepresentableEnum`` protocol in an app enum, use this type to build the URL for your type. Construct the type as a Swift string that contains characters suitable for use in a URL. To adjust the URL dynamically for your content, include a reference to your app enum value as part of the content. The following example shows an app enum type that includes the enum’s current value in the final URL: ```swift enum Destination: String, AppEnum, URLRepresentableEnum { case root case locationServices static var urlRepresentation = URLRepresentation("https://example.com/root=\(.rawValue)") } ``` If you need to differentiate URLs by more than the enum's current value, provide an array of values for your representation instead. The following example shows the same enum from the previous example, but with distinct strings for each case. ```swift enum Destination: String, AppEnum, URLRepresentableEnum { case root case locationServices static var urlRepresentation = URLRepresentation([ .root: "https://example.com/link1=\(.root)", .locationServices: "https://example.com/link2=\(.locationServices)" ]) } ``` Make sure you define your app enum type using a URL-friendly value. The system automatically converts values 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.
Members (0)
This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.
Skipped declarations
4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
EnumURLRepresentation.init(_:)
The containing type needs Swift generic type arguments. (no canonical witness for Enum)
EnumURLRepresentation.init(stringLiteral:)
The containing type needs Swift generic type arguments. (no canonical witness for Enum)
EnumURLRepresentation.init(stringInterpolation:)
The containing type needs Swift generic type arguments. (no canonical witness for Enum)
EnumURLRepresentation.init(_:)
This declaration needs Swift generic type arguments. (no canonical witness for Enum)