Place a sheet on one side with presentationPlacement on iPhone Duo

⋅ 4 min read ⋅ iOS SwiftUI UIKit

Table of Contents

On a regular iPhone, a sheet fills the width of the screen, so there is nothing to place. On an open iPhone Duo, the screen is wide, and a sheet only takes part of it.

iOS 27 lets you choose which side that sheet sits on:

  • SwiftUI: presentationPlacement(_:)
  • UIKit: UISheetPresentationController.preferredPlacement

How to use presentationPlacement

Like the other presentation modifiers, it goes on the content of the sheet, not on the view that presents it.

.sheet(isPresented: $showNewList) {
NewListView()
.presentationPlacement(.trailing)
}

There are four placements:

Placement What it asks for
.automatic The system decides. This is the default.
.leading The leading edge of the screen.
.center The middle of the screen.
.trailing The trailing edge of the screen.

.leading, .center, and .trailing are iOS only. On macOS, tvOS, watchOS, and visionOS, you only get .automatic.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Fully open

This is where the placement shows the most.

With .automatic, the sheet sits in the middle, with the app visible on both sides. .center looks the same.

A New List sheet in the middle of a fully open iPhone Duo, with the dimmed Reminders list visible on both sides.
.automatic on a fully open iPhone Duo. .center looks the same.

.leading moves the sheet to the leading edge, the left edge in a left-to-right language.

The New List sheet against the left edge of a fully open iPhone Duo, with the dimmed app visible on the right.
.leading puts the sheet on the leading edge.

.trailing moves it to the trailing edge, on the right. That edge is where iPhone Duo puts its vertical bar, so the sheet's Close and Done buttons move into the vertical bar too.

The New List sheet against the right edge of a fully open iPhone Duo, with close and done stacked in the vertical bar under the time.
.trailing puts the sheet against the edge with the vertical bar.

So the placement also decides how the toolbar looks. A sheet on the left keeps a horizontal toolbar at the top. A sheet on the right gets vertical controls. I covered that rule in Opt in to vertical bars on iPhone Duo.

Half-open

When iPhone Duo is partially folded, a sheet doesn't sit across the fold. That is the fold avoidance Apple describes for system components. So the sheet takes one half of the screen.

With .automatic, it goes to the left half.

On a half-open iPhone Duo, the New List sheet fills the left half, and the dimmed app shows on the right half.
.automatic on a half-open iPhone Duo. The sheet takes the left half.

.trailing puts it on the right half, with the controls in the vertical bar.

On a half-open iPhone Duo, the New List sheet fills the right half, with close and done stacked in the vertical bar under the time.
.trailing on a half-open iPhone Duo. The sheet takes the right half.

.center can't stay in the middle, because the middle is the fold. The sheet goes to the left half, the same as .automatic and .leading.

On a half-open iPhone Duo, a sheet with placement center still fills the left half instead of sitting over the fold.
.center on a half-open iPhone Duo. Fold avoidance wins, and the sheet goes left.

The placement is a preference, not a promise. The system still keeps the sheet off the fold.

Closed, and on other iPhones

On the outer display, the sheet fills the screen. The placement makes no difference. .leading and .trailing look the same. The controls go into the vertical bar, as they do for any sheet with a toolbar on the outer display.

On the closed iPhone Duo, the New List sheet fills the outer display, with close and done stacked vertically under the time on the right.
Closed iPhone Duo. The sheet fills the outer display whatever the placement.

It is the same on a regular iPhone. The sheet fills the width in both portrait and landscape, whatever the placement. You can add the modifier without checking which device you are on.

UIKit

In UIKit, set preferredPlacement on the sheet presentation controller before you present.

let newList = UINavigationController(rootViewController: NewListViewController())
if let sheet = newList.sheetPresentationController {
sheet.preferredPlacement = .trailing
}
present(newList, animated: true)

The values are the same four: .automatic, .leading, .center, and .trailing.

According to the UIKit header, preferredPlacement is ignored when sourceView is set. A sheet with a source view centers itself over that view instead.

When to use it

The default is a good choice for most sheets. Reach for a placement when the side matters, for example:

  • .trailing, when the sheet's actions should sit in the vertical bar, like the rest of your app's controls on the open device.
  • .leading, when the sheet should keep a regular horizontal toolbar.
  • .leading or .trailing, to keep one side of your layout visible next to the sheet.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Summary

  • presentationPlacement(_:) in SwiftUI and preferredPlacement in UIKit choose the side of a sheet. They are new in iOS 27.
  • They make a difference on an open iPhone Duo, where the sheet doesn't fill the screen.
  • .trailing puts the sheet next to the vertical bar, so its controls become vertical. .leading keeps them horizontal.
  • When half-open, the sheet takes one half. .center can't sit over the fold and goes to the left half.
  • Closed, and on a regular iPhone, the sheet fills the width, so the placement has no effect.

Read more article about iOS, SwiftUI, UIKit, or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

I also make short videos and visual guides on Patreon. Some things are easier to see than to read, like how an API looks and moves on a real screen. If you like to learn that way, come and watch. Sharing the article is also greatly appreciated.

Become a patron Tweet Share
Previous
When toolbar items share a glass background in iOS 26

In iOS 26, toolbar items next to each other merge into one Liquid Glass capsule. Learn which items merge, which ones stand alone, and how to split them with ToolbarSpacer.

← Home