Properly typed Core Data relationships

Is there a way to get CoreData to generate a relationship of type Set<T> instead of NSSet?

Unless something has changed recently, you just have to change the declaration in the generated header from NSSet to Set<Whatever>.


I don't recall off hand if there's an option somewhere to make XCode prefer the Swift type over the Objective-C type.

If I want to do that though I have to tell it None for the codegen, and then I was having some other issues. For example, I lose the ability to use the convenience initializer that just takes a context. That ends up getting an error saying:


"An NSManagedObject of class 'A.B' must have a valid NSEntityDescription"

Properly typed Core Data relationships
 
 
Q