The OrderedSet
in swift-collections
has many desirable properties.
But I can't quite figure out how to, or whether it is possible to, use it to replace the NSOrderedSet
to represent a relationship in CoreData entities.
Consider the following entity:
@objc(Ingredient)
class Ingredient: Entity {
@NSManaged var recipes: NSOrderedSet
}
The code won't compile if I change it to use OrderedSet
like the following
import OrderedCollections
class Ingredient: Entity {
@NSManaged var recipes: OrderedSet<Recipe>
}
The error message is error build: Property cannot be marked @NSManaged because its type cannot be represented in Objective-C
.