smallscript commented on issue #1288: URL: https://github.com/apache/cordova-ios/issues/1288#issuecomment-1434049875
Much as I would applaud that idea for unified behavior, doing what you suggest does not fix the problem. A solution requires properly adhering to Objective-C and Swift object construction patterns. Which means that `init` must be invoked on the Swift classes instances; which currently is not happening. The `initWithWebViewEngine:` is a correctly named and factored to be a convenience-init method and is calling the **designated** `init` it just isn't quite calling it correctly. It needs to call `self init` not `super init`. That's why I provided the correct change to `self = [self init]` that does it the right way and conforms to the iOS required model. To unify with `pluginInitialize` pattern would require that the `pluginInitialize` method invocation and signature be refactored to become the `NS_DESIGNATED_INITIALIZER`; which is quite a bit more refactoring than simply changing `super` to `self` in the `initWithWebViewEngine:`. Whichever refactoring change is made, it still must ensure that `init` is properly invoked on Swift class construction. Without that fix Swift based plugin classes are **unsafe**, **broken**, lead to very unexpected behavior. Which only someone who understands the internals of Swift and Cordova's plugin model would be able to figure out and once they did so they, in the end, would need to make the same basic 「`super` changed to `self`」 patch I tested and subsequently proposed. 🌈 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
