---
title: "outlineView(_:shouldExpandItem:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsoutlineviewdelegate/outlineview(_:shouldexpanditem:)"
---

# outlineView(_:shouldExpandItem:)

Returns a Boolean value that indicates whether the outline view should expand a given item.

## Declaration

```swift
@MainActor optional func outlineView(_ outlineView: NSOutlineView, shouldExpandItem item: Any) -> Bool
```

## Parameters

- `outlineView`: The outline view that sent the message.
- `item`: The item that should expand.

## Return Value

Return Value true to permit outlineView to expand item, false to deny permission.

## Discussion

Discussion The delegate can implement this method to disallow expanding of specific items.

## See Also

### Related Documentation

- [Outline View](appkit/outline-view.md)
- [Drag and Drop](appkit/drag-and-drop.md)

### Expanding and Collapsing the Outline

- [outlineView(_:shouldCollapseItem:)](appkit/nsoutlineviewdelegate/outlineview(_:shouldcollapseitem:).md)
