Reputation: 61834
This is my NSManagedObject
:
@objc(Order)
class Order: NSManagedObject {
@NSManaged var orderItems: Set<OrderItem> //error: Cannot specialize non-generic type 'Set'
}
Anyone know why it doesnt work?
OrderItem
file is created and works however for following declaration:
@NSManaged var orderItem: OrderItem
Upvotes: 3
Views: 2020
Reputation: 19821
Just for reference if someone should come to this question in the future for this nasty bug, since the discussion went on in the comments.
Yes, the default Set
type in Swift is generic, but in this case a custom non-generic Set
class was shadowing the class defined by the language's standard library.
Better always choose different names for your classes, to avoid name clashes. But if needed, you can always use the fully qualified name of the classes to refer to the class you want.
Standard language classes are available under the Swift.
namespace, while for other classes you can use the name of the module followed by a dot and the name of the class (e.g. Foundation.NSString).
Upvotes: 8