<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSToolbar/validateVisibleItems()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSToolbar(im)validateVisibleItems"
  },
  "title" : "validateVisibleItems()"
}
-->

# validateVisibleItems()

Validates the toolbar’s visible items during a window update.

```
func validateVisibleItems()
```

## Discussion

Typically, you override this method and use it to customize the validation process. The default implementation calls the [`validate()`](/documentation/AppKit/NSToolbarItem/validate()) method of each visible item in the toolbar, including items that have their [`autovalidates`](/documentation/AppKit/NSToolbarItem/autovalidates) property set to <doc://com.apple.documentation/documentation/Swift/false>. If you override this method, call `super` at some point during your implementation.

The toolbar doesn’t validate its content for some events, including [`NSLeftMouseDragged`](/documentation/AppKit/NSLeftMouseDragged), [`NSRightMouseDragged`](/documentation/AppKit/NSRightMouseDragged), [`NSOtherMouseDragged`](/documentation/AppKit/NSOtherMouseDragged), [`NSMouseEntered`](/documentation/AppKit/NSMouseEntered), [`NSMouseExited`](/documentation/AppKit/NSMouseExited), [`NSScrollWheel`](/documentation/AppKit/NSScrollWheel), [`NSCursorUpdate`](/documentation/AppKit/NSCursorUpdate), [`NSKeyDown`](/documentation/AppKit/NSKeyDown). In addition, the toolbar defers validation for [`NSKeyUp`](/documentation/AppKit/NSKeyUp) and [`NSFlagsChanged`](/documentation/AppKit/NSFlagsChanged) events until a pause of 0.85 seconds occurs or the window processes an event other than [`NSKeyUp`](/documentation/AppKit/NSKeyUp) or [`NSFlagsChanged`](/documentation/AppKit/NSFlagsChanged). So a rapid sequence of key events doesn’t trigger any validation.

To trigger validation for all toolbars, call the app’s [`setWindowsNeedUpdate(_:)`](/documentation/AppKit/NSApplication/setWindowsNeedUpdate(_:)) method with a value of <doc://com.apple.documentation/documentation/Swift/true>.

---

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)