<!--
{
  "availability" : [
    "macOS: 10.12.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSApplication/enumerateWindows(options:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSApplication(im)enumerateWindowsWithOptions:usingBlock:"
  },
  "title" : "enumerateWindows(options:using:)"
}
-->

# enumerateWindows(options:using:)

Executes a block for each of the app’s windows.

```
func enumerateWindows(options: NSApplication.WindowListOptions = [], using block: (NSWindow, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

`options`

A constant that indicates window ordering. See [`NSApplication.WindowListOptions`](/documentation/AppKit/NSApplication/WindowListOptions) for possible values.

`block`

The block to execute for each window. The block takes the following parameters:

- window: The window for which to execute the block.
- stop: A Boolean value that stops the enumeration early when set to <doc://com.apple.documentation/documentation/Swift/true> (the default value is <doc://com.apple.documentation/documentation/Swift/false>).

## Discussion

---

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)