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

# outlineView(_:viewFor:item:)

Implemented to return the view used to display the specified item and column.

```
@MainActor optional func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView?
```

## Parameters

`outlineView`

The outline view that sent the message.

`tableColumn`

The table column, or `nil` if the row is a group row.

`item`

The item displayed by the returned view.

## Return Value

The view to display the specified column and row. Returning `nil` is acceptable, in which case a view is not shown at that location.

## Discussion

This method is required if you wish to use `NSView` objects instead of `NSCell` objects for the cells within an outline view. Cells and views cannot be mixed within the same outline view.

It is recommended that the implementation of this method first call the `NSTableView` method [`makeView(withIdentifier:owner:)`](/documentation/AppKit/NSTableView/makeView(withIdentifier:owner:)) passing, respectively, the `tableColumn` parameter’s identifier and `self` as the owner to attempt to reuse a view that is no longer visible. The frame of the view returned by this method is not important, and is automatically set by the outline view.

The view’s properties should be properly set up before returning the result.

When using Cocoa bindings, this method is optional if at least one identifier has been associated with the table view at design time. If this method is not implemented, the outline view automatically calls [`makeView(withIdentifier:owner:)`](/documentation/AppKit/NSTableView/makeView(withIdentifier:owner:)) with the `tableColumn` parameter’s identifier and the outline view’s delegate as parameters, to attempt to reuse a previous view or automatically unarchive a prototype associated with the table view.

The [`autoresizingMask`](/documentation/AppKit/NSView/autoresizingMask-swift.property) of the returned view is automatically set to [`height`](/documentation/AppKit/NSView/AutoresizingMask-swift.struct/height) to resize properly on row height changes.

---

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)