I am building WKWebViews into my SwiftUI app. I am using the following implementation:
struct UrlWebView: UIViewRepresentable {
typealias UIViewType = WKWebView
var urlToDisplay: URL
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
webView.load(URLRequest(url: urlToDisplay))
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
}
}
struct WebView: View {
var game: Game
var body: some View {
UrlWebView(urlToDisplay: game.url)
}
}
initiated by
NavigationLink(destination: WebView(game: game))
There is some strange behavior that happens when I scroll where there is white space under the navigation header and above the web page...
iOS sim in WKWebView with white space
How can I get rid of the white space on top of the WKWebView (WHEN I SCROLL DOWN) while still keeping it scrollable?
Thank you so much.
EDIT: When I swipe down, there is no bounce back. Do you know how to fix this?