A SwiftUI component View that contains a WKWebView
Since WKWebView handles a lot of its own state, navigation stack, etc, it’s almost easier to treat it as a mutable data model. You can set it up prior to how you need it, and then simply use its data within your SwiftUI View’s.
Simply spin up a WebViewStore (optionally with your own WKWebView) and use that to access the WKWebView itself as if it was a data model.
WebView
A SwiftUI component
View
that contains aWKWebView
Since
WKWebView
handles a lot of its own state, navigation stack, etc, it’s almost easier to treat it as a mutable data model. You can set it up prior to how you need it, and then simply use its data within your SwiftUI View’s.Simply spin up a
WebViewStore
(optionally with your ownWKWebView
) and use that to access theWKWebView
itself as if it was a data model.Example usage: