The iOS plugin guide doesn't mention init methods for plugins. We should
fix this...
But first, how...
Right now we have:
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
> settings:(NSDictionary*)classSettings
> {
> self = [self initWithWebView:theWebView];
> if (self) {
> self.settings = classSettings;
> self.hasPendingOperation = NO;
> }
> return self;
> }
> - (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
> {
> self = [super init];
> ...
So... Looks like initWithWebView: is the designated initializer, but the
plugin doesn't get it's settings set until after it returns. Also,
self.viewController and self.commandDelegate get set after the initializer
altogether.
In Android, we use two-step initialization:
this.plugin = (CordovaPlugin) c.newInstance();
> this.plugin.initialize(ctx, webView);
We can't remove either initializer without breaking compatibility, but
maybe we could deprecate them?
I think it also makes sense to use two-phase initialization on iOS. Perhaps
"pluginDidInitialize".