Update to Swift 6 iOS 18 and .sheet
is now presented as small compared to previous versions on the iPad. I attempted to fix with the modifier .presentationDetents([.large], selection: $selectedDetent)
to set the sheet size .large
, but it didn't work. I'm wondering if there's an easy way to have the sheets display how they use to.
Notice the left is Swift 6 on iOS 17, while the right screenshot is Swift6 on iOS 18.
Use presentationSizing
to set the size of the sheet. Sheets before iOS 18 seem to be .page
by default, so you can use that.
.sheet(isPresented: $isPresented) {
Text("Something")
.presentationSizing(.page)
}
You can also declare your own sizings:
struct CustomSizing: PresentationSizing {
func proposedSize(for root: PresentationSizingRoot, context: PresentationSizingContext) -> ProposedViewSize {
.init(width: 200, height: 300)
}
}