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

# outlineView(_:shouldExpandItem:)

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

```
@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

<doc://com.apple.documentation/documentation/Swift/true> to permit `outlineView` to expand `item`, <doc://com.apple.documentation/documentation/Swift/false> to deny permission.

## Discussion

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

## See Also

[Outline View](/documentation/AppKit/outline-view)

Display a list-based interface for hierarchical data, where each level of hierarchy is indented from the previous one.

[Drag and Drop](/documentation/AppKit/drag-and-drop)

Support the direct manipulation of your app’s content using drag and drop.



---

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)