Skip to content

Commit

Permalink
Expose the currently active WebView
Browse files Browse the repository at this point in the history
  • Loading branch information
leonvogt committed Oct 15, 2024
1 parent 3ba9441 commit 591ea4b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/Turbo/Navigator/Navigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ public class Navigator {
public var rootViewController: UINavigationController { hierarchyController.navigationController }
public var modalRootViewController: UINavigationController { hierarchyController.modalNavigationController }
public var activeNavigationController: UINavigationController { hierarchyController.activeNavigationController }

public var activeWebView: WKWebView {
if activeNavigationController == rootViewController {
return session.webView
}
return modalSession.webView
}

/// Set to handle customize behavior of the `WKUIDelegate`.
///
/// Subclass `WKUIController` to add additional behavior alongside alert/confirm dialogs.
Expand Down

0 comments on commit 591ea4b

Please sign in to comment.