I'm trying to create an SwiftUI iOS app with a fullscreen WebView and having trouble with content going behind status bar. Eg with the following code:
import SwiftUI
import WebKit
struct ContentView: View {
var body: some View {
WebView(url: URL(string: "https://webkit.org"))
}
}
When I load webkit.org (on an iPhone 15 Pro Max, iOS 26.0.1) the top of the page is obscured by the status bar and dynamic island. In contrast, Safari displays a solid color under the status bar and offsets the start of the page. When the user scrolls, Safari does allow the content to go under the status bar but there is a darkening effect which keeps the status bar readable.
App using WebKit on load |
Safari on load | Safari after scrolling |
|---|---|---|
![]() |
![]() |
![]() |
Loading stackoverflow.com has a slightly different issue. On page load the content is correctly placed below the status bar but when the user scrolls the content appears below the status bar, above stackoverflow's menu bar. Safari doesn't have this issue.
App using WebKit on load |
App using WebKit after scrolling |
Safari after scrolling |
|---|---|---|
![]() |
![]() |
![]() |
How can I achieve similar behavior to Safari?
Ideally it would be identical but I would settle for the status bar being a solid color the whole time, hiding the content beneath.
I have experimented with applying:
.safeAreaPadding(.top).ignoresSafeArea([])
but these don't seem to have any impact.





