Hello all, I'm finding myself with a compile error when trying to use a defined UTType for Transferable conformance when the type is also an AppEntity.
The compiler error is
Could not determine the identifier of `.todo`. Please use a UTType defined by the UniformTypeIdentifiers framework
However, said compiler error only shows up after adding AppEntity conformance.
So, in order to reproduce:
- Create any type, conform to
Codable
struct Todo: Codable { var id: UUID var title: String var completed: Bool }
- Create a UTType extension for the new type
extension UTType { public static let todo: UTType = UTType(exportedAs: "org.nameghino.types.todo") }
- Add
Transferable
conformance
extension Todo: Transferable { static var transferRepresentation: some TransferRepresentation { CodableRepresentation(contentType: .todo) ProxyRepresentation(exporting: \.title) } }
At this point, the code compiles correctly on Xcode 16.2 beta 2 (16C5013f)
- Add
AppEntity
conformance
extension Todo: AppEntity { static var typeDisplayRepresentation: TypeDisplayRepresentation = "todo_title" static var defaultQuery = Todo.Query() var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "\(title)") } struct Query: EntityQuery { typealias Entity = Todo init() {} func entities(for identifiers: [UUID]) async throws -> [Todo] { return [] } func suggestedEntities() async throws -> [Entity] { return [] } } }
Now the code is not compiling with the aforementioned error.