I have a Core Data entity that has an attribute named id
:
@NSManaged public var id: Int
As I work with SwiftUI, I am adding support for Identifiable
, so then the Core Data entity now conforms to it:
extension Car : Identifiable { }
When I try to compile, I get this error for example when I try to use the id in a Predicate:
NSPredicate(format: "\(#keyPath(Car.id)) == \(id)")
Error:
Ambiguous reference to member 'id'
How can I make the Car
entity conform to Identifiable while keeping its already existing attribute id
?