Contents

urlRepresentationParameter

The string representation of the type’s content.

Declaration

var urlRepresentationParameter: String? { get async }

Discussion

Use this property to provide a string that describes your custom type. When specifying the string, use Swift interpolated values to incorporate data from any properties of your type, and specify only characters that URLs support. The following example shows a custom type that uses data from multiple properties to generate a string for URLs.

struct MyCustomType: CustomURLRepresentationParameterConvertible {
   var name: String
   var id: UUID

   var urlRepresentationParameter: String? { "\(name)/\(id)" }
}