Solution for full screen iPhone X?

Does the answer outlined in this post do what you want?

Basically just add this to the top of the WKWebViewController.swift file:

class FullScreenWKWebView: WKWebView {
    override var safeAreaInsets: UIEdgeInsets {
        return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
    }
}

And then when allocating/initializing the web view, use FullScreenWKWebView instead of WKWebView:

        webView = FullScreenWKWebView(frame: .zero, configuration: wconfiguration)

4 Likes