How it works
PlainWindowStyle is a window style that presents a window with none of the platform's standard decoration — no title bar, no traffic-light controls, and no surrounding chrome. Apply it when a scene's content should define the entire window surface itself, as for a custom HUD, a borderless tool palette, or an immersive presentation whose framing you draw yourself. You rarely name the type directly; instead you reach for it through the .plain style value and attach it to a scene with the windowStyle(_:) modifier.
Apply the style to a scene with windowStyle(_:)
Window styling is a scene-level concern, so PlainWindowStyle attaches to a Scene — typically a WindowGroup or Window — rather than to a view. You pass it to the windowStyle(_:) modifier, as in
WindowGroup { ContentView() }.windowStyle(.plain). The modifier propagates the style to every window the scene vends.Refer to the style with the .plain shorthand
Rather than writing
PlainWindowStyle(), SwiftUI exposes it as the static member.plainthrough the WindowStyle protocol's conformance, so the call site reads as.windowStyle(.plain). This mirrors the other built-in styles such as.automatic,.titleBar, and.hiddenTitleBar, letting you swap framing by changing a single value.Take responsibility for the window's own surface
Because PlainWindowStyle removes the title bar and background chrome, the scene's root content becomes the visible edge of the window. In the example the body supplies that surface itself — a
VStackcarrying amacwindowImage, aTextheadline, and aRoundedRectangle-clipped.regularMaterialbackground— standing in for the content you would render edge-to-edge inside a plain window.Provide your own affordances for moving and closing
With the standard controls stripped away, a plain window has no built-in drag region or close button. Design your content to offer those affordances — a draggable header area, an explicit dismiss control — so the window remains usable once
.windowStyle(.plain)removes the system framing.
.windowStyle(.plain) for .windowStyle(.titleBar) on the WindowGroup and the standard title bar and traffic-light controls reappear around the same content, making plain's stripped-down framing immediately visible by contrast.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.
struct PlainWindowStyleDemo: View {
var body: some View {
// PlainWindowStyle is applied to a scene via .windowStyle(.plain),
// which strips the title bar and default window chrome.
// Conceptually: WindowGroup { ContentView() }.windowStyle(.plain)
VStack(spacing: 8) {
Image(systemName: "macwindow")
.font(.largeTitle)
Text("Plain Window")
.font(.headline)
Text("No title bar or chrome")
.font(.caption)
.foregroundStyle(.secondary)
}
.padding(24)
.background(.regularMaterial, in: RoundedRectangle(cornerRadius: 12))
.padding()
}
}