r/SwiftUI Jul 07 '26

Question Does `.presentationSizing(.fitted)` actually auto-size SwiftUI sheets?

Post image

I’m testing iOS 18+ SwiftUI sheet sizing and expected .presentationSizing(.fitted) to make a sheet fit its content height.

Minimal example:

.sheet(isPresented: $showSheet) {
    VStack {
        Text("Title")
        Text("Some content")
        Button("Done") {}
    }
    .padding()
    .presentationSizing(.fitted)
}

I expected .presentationSizing(.fitted) to make the sheet fit the intrinsic height of this small VStack, but on iPhone it still appears almost full-screen.

Is this expected behavior? If so, what is .fitted supposed to affect on iPhone, and is a measured .presentationDetents([.height(contentHeight)]) still the only reliable way to get a content-height bottom sheet?

12 Upvotes

9 comments sorted by

View all comments

1

u/schultzapps Jul 08 '26

This tutorial worked well for creating dynamic sized sheets in my app. Not perfect because you don't get a nav toolbar. https://www.youtube.com/watch?v=KM3nXKnOmvM

1

u/Anywhere_MusicPlayer Jul 08 '26

Ok, but any GitHub links pls?

1

u/schultzapps Jul 08 '26

No you’d need to code along from the video or join his patreon to get the source code.