Swift version: 5.2
Before iOS 11 it was common to create views that went edge to edge on the screen, taking up all available space in the glass rectangle of the iOS display. However, from iOS 11 onwards Apple introduced the safe area layout guide, which is a feature that restricts the edges of views so they don’t get clipped by the rounded corners and notch of the iPhone X.
You don’t need to make your view fall inside the safe area, and in fact it’s common to ignore this for background views that should fill the screen behind your content. For example, the built-in Weather app runs its background graphics edge to edge, then puts its main content inside the safe area.
If you use view controller containers such as
UITabBarController they will automatically keep your content clear of the safe area so you don’t need to worry about it. Otherwise, you should switch all your Auto Layout constraints over to the safe area layout guide inside Interface Builder – IB will automatically generate backwards-compatible constraints for older versions of iOS.
SPONSORED ViRE offers discoverable way of working with regex. It provides really readable regex experience, code complete & cheat sheet, unit tests, powerful replace system, step-by-step search & replace, regex visual scheme, regex history & playground. ViRE is available on Mac & iPad.
Available from iOS
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Link copied to your pasteboard.