UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

ScrollView in SwiftUI 2 overwriting Safe Area?

Forums > SwiftUI

I've just built one of Paul's examples (SwiftUI by Example - How to add horizontal and vertical scrolling using ScrollView) where he writes "... because it automatically sizes itself to ft the content we place inside it and also automatically adds extra insets to avoid the safe area"

I've run it on my iPhone SE 1st gen (iOS 14) and the rectangles go under the status bar (which may not be a safe area?).

I then ran it on the iPhone 11 Simulator and they clearly go over the safe area (the notch, time and battery). Is this a change in SwiftUI 2 a bug that I should report to Apple?!


If you think it an unexpected behaviour then use the Feedback app on your device to report it.


I'm not sure if it's unexpected!

If I add a NavigationView() then it behaves. Maybe that is how it's meant to be used.


Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.