<!--
{
  "availability" : [
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/UtilityWindow",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13UtilityWindowV"
  },
  "title" : "UtilityWindow"
}
-->

# UtilityWindow

A specialized window scene that provides secondary utility to the content
of the main scenes of an application.

```
nonisolated struct UtilityWindow<Content> where Content : View
```

## Overview

Utility windows are typically used to display controls, settings, or
information associated the main content of an application, sometimes
referred to as tool palettes or inspector windows. Because of this
role, they have specialized behavior compared to all other windows:

- They receive `FocusedValues` from the focused main scene in an application,
  similar to commands in the main menu, which can be used to display
  information on the active content as the user focuses on different scenes.
- They have a default window level of `.floating` so they remain visible
  when moving focus between the main scenes.
- They hide when the window is no longer active.
- They only become focused when explicitly needed, such as clicking
  in the titlebar or on a focusable view.
- When focused, they can be dismissed with the Escape key.
- They are not minimizable by default.

```swift
@main
struct PhotoBrowser: App {
    var body: some Scene {
        WindowGroup {
            PhotoGallery()
        }

        UtilityWindow("Photo Info", id: "photo-info") {
            PhotoInfoViewer()
        }
    }
}

struct PhotoInfoViewer: View {
    // Automatically updates to the photo selection from whichever
    // photo gallery window is focused.
    @FocusedValue(PhotoSelection.self) private var selectedPhotos

    var body: some View {
        Text("\(selectedPhotos?.count ?? 0) photos selected")
    }
}
```

`UtilityWindow` will automatically add a menu item to show/hide itself in
the “View” menu. This can be removed by applying [`commandsRemoved()`](/documentation/SwiftUI/Scene/commandsRemoved())
to the utility window, and manually placing a [`WindowVisibilityToggle`](/documentation/SwiftUI/WindowVisibilityToggle)
elsewhere in an app’s commands. Utility windows can also be programmatically
presented with [`openWindow`](/documentation/SwiftUI/EnvironmentValues/openWindow) and dismissed using
[`dismiss`](/documentation/SwiftUI/EnvironmentValues/dismiss).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)