You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Love your work on this, makes it so much easier for me to implement swiftui webview.
I was playing around with it to see if I can save the page's url but because the your webview package is constructed on load i couldnt use the general " webView.url" call.
I added the following code on your WebViewCoordinator extension after calling " public internal(set) var pageURL: String?
" on your WebViewState constructor
webView.evaluateJavaScript("document.URL.toString()") { (response, error) in
if let url = response as? String {
var newState = self.webView.state
newState.pageURL = url
self.webView.state = newState
}
}
Think itd be a great function to have especially for newbies like me so they dont have to go chasing around the code trying to figure out how to load the url : )
The text was updated successfully, but these errors were encountered:
Love your work on this, makes it so much easier for me to implement swiftui webview.
I was playing around with it to see if I can save the page's url but because the your webview package is constructed on load i couldnt use the general " webView.url" call.
I added the following code on your WebViewCoordinator extension after calling " public internal(set) var pageURL: String?
" on your WebViewState constructor
webView.evaluateJavaScript("document.URL.toString()") { (response, error) in
if let url = response as? String {
var newState = self.webView.state
newState.pageURL = url
self.webView.state = newState
}
}
Think itd be a great function to have especially for newbies like me so they dont have to go chasing around the code trying to figure out how to load the url : )
The text was updated successfully, but these errors were encountered: