Last active
April 29, 2020 16:44
-
-
Save prafullakumar/3684606b7bca3dc8ecd36df0f202dbd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@ObservedObject var webViewStateModel: WebViewStateModel = WebViewStateModel() | |
var body: some View { | |
NavigationView { | |
LoadingView(isShowing: .constant(webViewStateModel.loading)) { //loading logic taken from https://stackoverflow.com/a/56496896/9838937 | |
//Add onNavigationAction if callback needed | |
WebView(url: URL.init(string: "https://www.google.com")!, webViewStateModel: self.webViewStateModel) // add | |
} | |
.navigationBarTitle(Text(webViewStateModel.pageTitle), displayMode: .inline) | |
.navigationBarItems(trailing: | |
Button("Last Page") { | |
self.webViewStateModel.goBack.toggle() | |
}.disabled(!webViewStateModel.canGoBack) | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment