TechnologiesSwiftUIPresentation and Dialogs

FormPresentationSizing struct

iOSmacOStvOSwatchOSvisionOSiOS 18.0+✓ renders

The size is appropriate for forms and slightly less wide than`.page`

How it works

FormPresentationSizing is a concrete presentation-sizing type that tells SwiftUI to size a presented view the way the system sizes its own form-style sheets, rather than letting the content's intrinsic size or the full screen dictate the bounds. When you present a Form, settings panel, or editing dialog, you usually want a compact, system-consistent footprint that adapts across platforms; reaching for FormPresentationSizing gives you that behavior without hand-tuning frames or detents. You don't construct it directly in most code — you apply it through the .form value passed to the presentationSizing(_:) modifier on the presented content.

  1. Apply it with presentationSizing(.form)

    FormPresentationSizing is delivered to a presented view through the presentationSizing(_:) modifier, which accepts any PresentationSizing value. Calling .presentationSizing(.form) on the sheet's content selects this form-appropriate sizing so the presentation adopts the system's standard form dimensions.

  2. Reach it through the .form static accessor

    Rather than calling an initializer, you obtain the value from the type-inferred static member .form, which vends a FormPresentationSizing instance. This is the static-property convention SwiftUI uses for sizing values, so the call site reads as .presentationSizing(.form) with the leading-dot shorthand resolving to FormPresentationSizing.

  3. Place it inside a presentation container

    FormPresentationSizing only takes effect on content that is actually being presented, so it belongs on the view supplied to a presentation modifier. In the example it is attached to the Form inside the .sheet(isPresented:) closure, where the sizing governs how that sheet's bounds are computed.

  4. Combine with other presentation modifiers

    Because presentationSizing(_:) participates in the standard modifier chain, FormPresentationSizing composes with adjacent presentation and layout modifiers applied to the same presented content. Here .presentationSizing(.form) sits alongside .padding() on the Form, letting the form-style sizing coexist with content insets.

Try it — Change .presentationSizing(.form) to .presentationSizing(.page) and present the same Form to see how the form-style footprint differs from a full-page presentation.

Example & preview

Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.

FormPresentationSizing.swift
struct FormPresentationSizingDemo: View {
    @State private var showingForm = true

    var body: some View {
        Text("Tap to edit settings")
            .padding()
            .sheet(isPresented: $showingForm) {
                Form {
                    Section("Profile") {
                        TextField("Name", text: .constant("Ada"))
                        Toggle("Notifications", isOn: .constant(true))
                    }
                }
                .presentationSizing(.form)
                .padding()
            }
    }
}
Live preview
Tap to edit settings Profile Name Notifications
Tap to edit settings Profile Name Notifications
swift → lexer → parser → sema → uiir → canvas Open in Studio ↗
What's new in SwiftUI 27 →