I am trying to implement URLRepresentableEntity
on my AppEntity
I am following along with the WWDC video here
All compiles fine when I use the ID as in the video:
extension SceneEntity: URLRepresentableEntity { static var urlRepresentation: URLRepresentation { "https://example.com/scene/\(.id)" } }
but my URLs need to use a different property on the Entity. The WWDC video clearly states: "Notice that I'm using the entity’s identifier as an interpolated value. You can use an entity’s ID or any of its properties with the @Property attribute as interpolations in the URL string."
So I annotated my entity with the @Property attribute and expected that to work but it doesn't compile.
struct SceneEntity: AppEntity { let id: UUID @Property(title: "Slug") var slug: String } extension SceneEntity: URLRepresentableEntity { static var urlRepresentation: URLRepresentation { "https://example.com/scene/\(.slug)" } }
Type 'EntityURLRepresentation<SceneEntity>.StringInterpolation.Token' has no member 'slug'
How can I use this API with a property that is not the ID?