I'm getting an "ambiguous use of init" error when building with Xcode 7.3 and Swift 2.2
The issue is related to two Objective-C classes and how Swift views their initializers.
Objc sees:
Superclass
@interface Foo: NSManagedObject
+(instancetype)fooWithOwner:(Owner *)owner insertIntoManagedObjectContext:(NSManagedObjectContext *)context;
Subclass
@interface Bar: Foo
+(instancetype)barWithOwner:(Owner *)owner insertIntoManagedObjectContext:(NSManagedObjectContext *)context;
while Swift only sees:
init(owner: Owner!, insertIntoManagedObjectContext context: NSManagedObjectContext!)
which is causing the compiler to be unsure of which init is being called on the subclass "Bar". Is there a way to specify which initializer to use when initializing the subclass? I'd like to avoid refactoring the init method if possible.