SwiftUI sheet ignores detent on rapid second presentation

Given a SwiftUI sheet with presentation detent(s):

struct ContentView: View {
@State var isSheetOpen = false
var body: some View {
Button("Open Sheet") {
isSheetOpen = true
}
.sheet(isPresented: $isSheetOpen) {
Color.black
.presentationDetents([.medium])
}
}
}

If you:

  • open the sheet
  • close it and rapidly open it again

the second presentation will ignore the detent and open a full screen sheet instead.

Xcode 16.3, iOS 18.4

Bug report FB17115890

Thanks for filling the bug report. The engineering team will investigate the issue.

This problem appeared with iOS 18.

As one of the workarounds, you can add a delay before giving the option to open it again.

SwiftUI sheet ignores detent on rapid second presentation
 
 
Q