WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

SOLVED: Project 4 - WKWebView and safe area issue on new Xcode and iOS

Forums > 100 Days of Swift


I'm struggling to solve the issue where WKWebView lies under the safe area so it is also covered with the title and the button.

In the original tutorial everything works fine, but in newer Xcode version something changed and I can't quite understand where to dig.


Anyone knows how to fix it?



Hi @Beavean,

If you haven't embedded it in navigation controller yet, please do so. After, doing so, while your navigation contoller is chosen in storyboard, check bar visibility is ticked in Attributes Inspector -> Under Navigation Controller - Bar Visibility.

Hope this is what you wanted to have :) Otherwise the issue is mainly with apple.com, and if you scroll up it looks ok. But otherwise it's not so crucial in that project :)



Thanks for your advice.

Unfortunately, Bar Visibility checks are not affecting the issue.

Other websites are also covered as well as apple.com. https://imgur.com/R8Pqu92

I found a way to lower the browser area below the safe area by adding this: navigationController?.navigationBar.isTranslucent = false

This seems not to be right, so I still hope to find the solution. https://imgur.com/vvuQfWx


Ok, guess now I recall how I fixed that. In Document Outline pane, choose Navigation Controller Scene ->Navigation Controller->Navigation Bar. While the latter is chosen, in Attributes Inspector under Navigation Bar section click on Scroll Edges. But in this case I think isTranslucent should be true...

Added: Or basically in viewDidLoad() add this: navigationController?.navigationBar.scrollEdgeAppearance = UINavigationBarAppearance()


Hacking with Swift is sponsored by Emerge

SPONSORED Why are Swift reference types bad for app startup time, and what’s the performance cost of protocol conformances? That’s just a couple of the topics you can learn about on the Emerge blog — written by the app performance experts behind Emerge’s advanced app optimization and monitoring tools, based on their experience of working at companies like Apple, Airbnb, Snap, and Spotify.

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.