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

# outlineView(_:persistentObjectForItem:)

Invoked by `outlineView` to return an archived object for `item`.

```
@MainActor optional func outlineView(_ outlineView: NSOutlineView, persistentObjectForItem item: Any?) -> Any?
```

## Parameters

`outlineView`

The outline view that sent the message.

`item`

The item for which to return an archived object.

## Return Value

An archived representation of `item`. If the item is an archived object, this method may return the item.

## Discussion

When the outline view is saving the expanded items, this method is called for each expanded item, to translate the outline view item to an archived object.

### Special Considerations

You must implement this method if you are automatically saving expanded items (that is, if [`autosaveExpandedItems`](/documentation/AppKit/NSOutlineView/autosaveExpandedItems) returns <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)