Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Pass all SessionDelegate callbacks through to TurboNavigationDelegate #73

Closed
wants to merge 4 commits into from

Conversation

joemasilotti
Copy link
Owner

Continuing the conversation from #72, this approach passes all unused SessionDelegate callbacks through TurboNavigationDelegate without modification.

This gives developers an option to override whatever part of SessionDelegate they want. They can implement their functionality in their existing TurboNavigationDelegate extension.

extension SceneDelegate: TurboNavigationDelegate {
    func sessionDidFinishRequest(_ session: Session) {
        // TODO: Custom handling.
    }
}

It also provides a default WKUIDelegate implementation, handling alerts and confirmation dialogs. If a developer wants more customization they are encouraged to copy-paste the extension TurboNavigator: WKUIDelegate extension and overwrite and/or add functionality of their own. Making currentNavigationController public enables this to be possible.

Helpful when completely custom navigation is required, like presenting a
modal from:

```
WKUIDelegate.webView(_:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)
```
@joemasilotti
Copy link
Owner Author

Closed in favor of #74.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant