iosswiftdependency-injectiontyphoon

Typhoon Injection - Crashing when injecting parameters using initializer


I am following Typhoon Coredata example (https://github.com/appsquickly/Typhoon-CoreData-RAC-Example) to configure coredata in swift.

But i am getting exception in the following method

public dynamic func managedObjectModel() -> AnyObject {
        return TyphoonDefinition.withClass(NSManagedObjectModel.self){
            (definition) in
            definition.useInitializer("contentsOfURL:"){
                (initializer) in
                 initializer.injectParameterWith(self.modelUrl())
            }
        }
    }

In the above function, i am trying to inject modelurl to "contentsOfURL" method of NSManagedObjectModel class. But i am getting following error

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Method 'contentsOfURL:' not found on 'NSManagedObjectModel'. Did you include the required ':' characters to signify arguments?'

//

//NSManagedObjectModel class  
    public convenience init?(contentsOfURL url: NSURL)

Solution

  • definition.useInitializer("initWithContentsOfURL:")