Hack around WKWebView's white flashing that it does while loading content
This commit is contained in:
parent
680385fe58
commit
5088878721
|
@ -28,6 +28,7 @@ class DetailViewController: UIViewController {
|
|||
override func viewDidLoad() {
|
||||
|
||||
super.viewDidLoad()
|
||||
webView.isHidden = true
|
||||
webView.navigationDelegate = self
|
||||
|
||||
markAsRead()
|
||||
|
@ -211,6 +212,15 @@ extension DetailViewController: WKNavigationDelegate {
|
|||
|
||||
}
|
||||
|
||||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||
// We initially hide the webview and only show it after it has loaded to avoid the
|
||||
// white flashing that WKWebView does when it loads. This is especially noticable
|
||||
// in dark mode.
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
||||
webView.isHidden = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension DetailViewController {
|
||||
|
|
Loading…
Reference in New Issue