Contents

urlRepresentation

The URL representation of the app entity.

Declaration

static var urlRepresentation: Self.URLRepresentation { get }

Discussion

Use this property to store the URL for your app entity. When setting the value of this property, you can use a combination of static text and placeholder values to generate the final URL. The following code creates a representation for the entity that includes its unique ID:

struct MyAppData: AppEntity, URLRepresentableEntity {
    static let defaultQuery = MyAppDataQuery()

    @Property(title: "Content ID")
    var contentID: String

    static var urlRepresentation = URLRepresentation("https://example.com/note=\(.$contentID)")
}