what is the difference between two initializers of NSManagedObject

Hi,

If somebody could please help me on what is the difference on creating an object of NSManagedObject subclass from these initialization methods:


init(context:)

vs

init(entity:insertInto:)


Thanks.

Replies

This is covered in the comments of NSManagedObject.h. Init infers the entity from the class, so it's only valid to call on subclasses of NSManagedObject. initWithEntity takes the entity as an argument, so it can be used without declaring a subclass.