Open W2N-git opened 9 years ago
Oops, that's actually an Apple bug and I'd left the work-around un-commented in the last commit. In ApplicationAssembly.swift
take a look tat these lines:
definition.useInitializer("initWithNibName:bundle:") {
(initializer) in
initializer.injectParameterWith("AddCity")
initializer.injectParameterWith(NSBundle.mainBundle())
}
What happens is that this method will use vtable-style dispatch, even if a sub-class overrides it and marks it as dynamic
. Therefore it can't be invoked dynamically with the objective-C runtime.
The workaround is to create another custom initializer, in this case simply init
, hence the above code in the assembly should be commented out.
The other Swift issue that we encountered was #286, and this was fixed very quickly by Apple, but as I understand it, this one hasn't been submitted to them yet. (Let's face it the Radar bug tracker is kinda tedious, right?). But I'll do so today.
Meantime will comment that code again.
Re-commented ApplicationAssembly.swift
to apply workaround. Meanwhile submitted issue report, and here's the open radar: https://openradar.appspot.com/radar?id=6174436327686144
fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'PocketForecast.AddCityViewController'
Just mistake in initializer name required dynamic init(nibname : String?, bundle : NSBundle?)