I am also trying to get full-screen working with WKWebView, it it appears to go full screen without an error, but always appears behind glass overlay? Very frustrating, I have no idea why. (See image)
Here is my code:
func makeUIView(context: Context) -> WKWebView {
let webConfiguration = WKWebViewConfiguration()
webConfiguration.allowsInlineMediaPlayback = true
webConfiguration.preferences.isElementFullscreenEnabled = true
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
webView.configuration.allowsInlineMediaPlayback = true
webView.load(URLRequest(url: URL(string: "https://www.youtube.com/watch?v=7q1eDpuBFnI")!))
return webView
}
I noticed you don't have:
webConfiguration.preferences.isElementFullscreenEnabled = true
But maybe that is intended for your coordinator approach. Were you able to figure it out?