TechnologiesSwiftUIScenes and Windows

DefaultWindowStyle struct

iOSmacOStvOSwatchOSvisionOS✓ renders

The default window style.

How it works

DefaultWindowStyle describes the platform's standard window appearance — a titled window with the usual system chrome, controls, and background treatment. It's the style a WindowGroup or Window scene adopts when you don't ask for anything else, so you rarely instantiate it directly; instead, it represents the baseline that other styles such as .hiddenTitleBar or .plain depart from. Reach for it when you've applied a custom style somewhere in your scene hierarchy and want a particular window to return to the system default, or when you want to state that intent explicitly in code.

  1. Apply it through the windowStyle(_:) scene modifier

    Window styles are set on a scene, not a view, by attaching windowStyle(_:) to a WindowGroup or Window. The default is requested with the .automatic case, which resolves to DefaultWindowStyle for the current platform — the same value shown in the example's label .windowStyle(.automatic).

  2. Prefer the .automatic shorthand over the initializer

    DefaultWindowStyle conforms to WindowStyle, and SwiftUI exposes it through the static .automatic accessor so you write .windowStyle(.automatic) rather than constructing DefaultWindowStyle() yourself. Using .automatic keeps your scene aligned with whatever the system considers standard, which can differ across macOS, iPadOS, and visionOS.

  3. Understand what the default supplies

    Choosing the default style means SwiftUI provides the conventional title bar, traffic-light controls, and a system-managed background — the platform's expected window dressing. The view content inside, such as the VStack with its macwindow Image and headline Text, is laid out within that standard window frame.

  4. Use it to override an inherited style

    Because window styles propagate to nested scenes, DefaultWindowStyle is how you opt a specific window back into the standard look after an ancestor selected something else. Applying .windowStyle(.automatic) on that scene re-establishes the platform default rather than inheriting the custom chrome.

Try it — Change the modifier shown in the .windowStyle(.automatic) label to .windowStyle(.hiddenTitleBar) on the enclosing scene and run on macOS to watch the standard title bar that DefaultWindowStyle supplies disappear.

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.

DefaultWindowStyle.swift
struct DefaultWindowStyleDemo: View {
    var body: some View {
        VStack(spacing: 12) {
            Image(systemName: "macwindow")
                .font(.largeTitle)
                .foregroundStyle(.tint)
            Text("Default Window Style")
                .font(.headline)
            Text(".windowStyle(.automatic)")
                .font(.system(.footnote, design: .monospaced))
                .foregroundStyle(.secondary)
        }
        .padding(24)
        .background(.regularMaterial, in: RoundedRectangle(cornerRadius: 12))
        .padding()
    }
}
Live preview
Default Window Style .windowStyle(.automatic)
Default Window Style .windowStyle(.automatic)
swift → lexer → parser → sema → uiir → canvas Open in Studio ↗
What's new in SwiftUI 27 →