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?!

3      

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

3      

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.

3      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out 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.