Bug with Transferable + AppEntity

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:

  1. Create any type, conform to Codable
struct Todo: Codable {
var id: UUID
var title: String
var completed: Bool
}
  1. Create a UTType extension for the new type
extension UTType {
public static let todo: UTType = UTType(exportedAs: "org.nameghino.types.todo")
}
  1. 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)

  1. 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.

I was bored so played with this a bit - I couldn't make it work with a custom type. Works fine if you use the built-in 'todoItem' type. Seems like a bug, yeah.

I had filed a radar (FB15724619). I'm still experiencing this in 16.2b3

Any news on this? Looks like it is still an issue in the GM.

Bug with Transferable + AppEntity
 
 
Q