Wednesday, November 11, 2026
HomeiOS Developmentios - How you can do away with white area above WKWebView...

ios – How you can do away with white area above WKWebView with SwiftUI

[ad_1]

I’m constructing WKWebViews into my SwiftUI app. I’m utilizing the next 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 sport: Recreation
    
    var physique: some View {
        UrlWebView(urlToDisplay: sport.url)
    }
}

initiated by

 NavigationLink(vacation spot: WebView(sport: sport))

There’s some unusual habits that occurs after I scroll the place there may be white area underneath the navigation header and above the online web page…

iOS sim in WKWebView with white area

How can I do away with the white area on high of the WKWebView whereas nonetheless maintaining it scrollable?

Thanks a lot.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments