Layout margins guides are still broken the iPhone Duo (sim) and 27.1 RC

Layout margin guides are broken throughout UIKit and SwiftUI on the iPhone Duo sim in iOS 27.1 RC.

For example, a cell which looks perfectly fine on a normal iPhone sim (which has a compact horizontal size class), has zero vertical layout margins on iPhone Duo.

Here's some screenshots. The red dotted lines are supposed to show the margins in the cell content view, i.e., the boundary between default padding around the cell (for its background) and the content of the cell.

On every other device and size class these all work, and will have some vertical margin.

iPhone 18 Pro:

iPhone Duo:

As you can see, the border is cut off. No vertical margins at all.

iPhone Duo Unfolded:

Not only is it busted just in UICollectionViews. Check out this segmented control (also configured with layout margins). This works fine on catalyst, iPhone, and iPad.

This makes me very nervous about shipping with the 27.1 SDK.

Is this a known issue? If so, what is the recommended workaround in the meantime?

FB25097501

Answered by Frameworks Engineer in 908399022

On iOS 27.1 and later, the default layout margins for a UIView are zero. A view controller continues to provide its view with systemMinimumLayoutMargins, which vary depending on the presentation context. To inherit these margins in a subview of the view controller’s view, set its preservesSuperviewLayoutMargins property to true.

On iOS 27.1 and later, the default layout margins for a UIView are zero. A view controller continues to provide its view with systemMinimumLayoutMargins, which vary depending on the presentation context. To inherit these margins in a subview of the view controller’s view, set its preservesSuperviewLayoutMargins property to true.

@Frameworks Engineer

Thanks for the quick reply. I'm having trouble squaring it with what I'm seeing though, and I'd appreciate a little more detail & clarification so I can handle the layout for the Duo correctly in our app.

  1. This only happens on the iPhone Duo. On the same iOS 27.1 runtime, the same cell on iPhone and iPad gets nonzero margins. If the default changed to zero for every UIView in 27.1 as you stated, I'd expect it on every device. So it implies a special case for Duo for every cell / view that relies on this. Why am I seeing behavior specific to Duo if all UIView layout margins are expected to be zero?

  2. This guidance contradicts longstanding guidance and documentation. The current layoutMargins docs say the following:

For other subviews in your view hierarchy, the default layout margins are normally 8 points on each side, but the values may be greater if the view is not fully inside the safe area or if the preservesSuperviewLayoutMargins property is true.

If zero is now intended, the docs and release notes don't say this. Further, the previous understanding meant that preserving the superview margins could mean my view inherited greater margins, which is not what I want.

3.. The suggested fix doesn't restore vertical spacing because the superview's margins are also zero. Further, view controller's systemMinimumLayoutMargins are zero on top and bottom on iPhone, so inheriting them with preservesSuperviewLayoutMargins would still give zero vertical margins.

Here's the result of the suggested fix. Vertical margins are still zero.

Given the above, are we still positive this issue isn't a bug?

Layout margins guides are still broken the iPhone Duo (sim) and 27.1 RC
 
 
Q