.presentationDetents not working on iOS 17

Hello, I have the following code:

.sheet(isPresented: $viewModel.isExerciseSelected) {
            ExerciseEditSheetView(viewModel: viewModel)
                .presentationDetents([.fraction(0.4)])
        }

This code correctly sizes the sheet on my iOS 18 simulator, but does not work on my iOS 17 simulator as well as my actual phone running iOS 17. Instead the sheet always fullscreens. Although its not the end of the world it is pretty annoying. Is there anything I'm missing? Thanks in advance.

@JoeBro Could you verify on a physical device running iOS 18.0 and please open a bug report regarding the issue and include a focus sample project that reproduces the issue.

Please post the FB number here for my reference. If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

I've just experienced something similar to this with Xcode Version 26.0 (17A321) I don't have any other versions of Xcode I can try this with.

Supplying .presentationDetents() with any value, e.g. .presentationDetents([.height(250)]) or .presentationDetents([.medium, .large]), does the following:

  • iOS 17.5 Simulator: The sheet is not displayed at all, effectively freezing the app as there's no sheet displayed and no way to dismiss it.
  • iOS 18.5 Simulator: The sheet is 250px tall.
  • iOS 26.0 Simulator: The sheet is 250px tall.

My current workaround is to do this:

.sheet(isPresented: $showSheet) {
  if #available(iOS 18.0, *) {
    ChooseImageSheet(showSheet: $showSheet)
      .presentationDetents([.height(250)])

  } else {
    ChooseImageSheet(showSheet: $showSheet)
  }
}

It's not elegant having to repeat some code without a modifier on it in this way. Also, this forces the sheet to use the .large detent, which fills the screen and isn't really appropriate for what I need to display in the sheet.

Sadly, I can't provide a sample project that exhibits this behaviour, as something as simple as this code doesn't exhibit it:

import SwiftUI

struct ContentView: View {
	@State private var showSheet: Bool = false

	var body: some View {
        VStack {
			Button {
				showSheet.toggle()
			} label: {
				Text("Show the sheet")
			}
        }
        .padding()

		.sheet(isPresented: $showSheet) {
			SheetView()
				.presentationDetents([.height(200)])
		}
    }
}

struct SheetView: View {
	var body: some View {
		ZStack {
			Color.blue.opacity(0.4)

			Text("I'm the sheet! Hi!")
				.foregroundStyle(Color.black)
		}
		.ignoresSafeArea()
	}
}

#Preview {
    ContentView()
}
.presentationDetents not working on iOS 17
 
 
Q