-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(iOS): Open CAPBridgeViewController for subclassing #3973
Conversation
… swift interface.
…efine the entry point to a web app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we instead of having the webViewClass
thing have an open method where the WebView is created so they can override that instead?
That way if their custom WKWebView
subclass has a custom init they can use it, with current implementation it's not possible.
hello everyone, first of all thanks for opening CAPBridgeViewController so we can create subclasses, but I am facing blockers when adding hooks to web view lifecycle like didFinish, didFail etc, due to existing loadView is final function that have: existing capacitor 6.1.0 file CAPBridgeViewController: |
This branch refactors CAPBridgeViewController to make it available for subclassing. This is necessary for many embedded uses and allows it address several outstanding issues.
Subclasses can override
webView(with:configuration:)
to return a custom subclass of WKWebView if desired. This addresses feat(ios): Add ios capacitor config to use a custom wkwebview #3095Subclasses can override
instanceDescriptor
to modify the capacitor configuration at runtime after the config file is loaded, or to completely customize the environment. This addresses feat: Support loading from alternate path #3912 & feat: Ability to modify config during bridge initialization #3913 as well as allow for embedded uses where the web app will not exist in the expected locations in the application bundle.Subclasses can override
webViewConfiguration
to make any changes to the configuration before it is used to instantiate the web view. This addresses How to set additional wkWebView settings #1097Subclasses can override
capacitorDidLoad
orviewDidLoad
to make any desired changes to the webview or related views. This provides a stable point for operations like Added disable drag and drop in a WKWebView. #3546 without requiring that the code be merged in upstream or added via a plugin.In addition, this branch unifies much of the path handling to ensure that the config is the one true source for where the web app is located. It also eliminates some of the side effects of the previous implementation like
isNewBinary()
modifying UserDefaults such that it would return different results on subsequent invocations.