---
title: NSOutlineView
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsoutlineview
---

# NSOutlineView

A view that uses a row-and-column format to display hierarchical data like directories and files that can be expanded and collapsed.

## Declaration

```swift
class NSOutlineView
```

## Overview

Overview Like a table view, an outline view does not store its own data, instead it retrieves data values as needed from a data source to which it has a weak reference (see Delegates and Data Sources). See NSOutlineViewDataSource, which declares the methods that an NSOutlineView object uses to access the contents of its data source object. An outline view has the following features: A user can expand and collapse rows, edit values, and resize and rearrange columns. Each item in the outline view must be unique. In order for the collapsed state to remain consistent between reloads the item’s pointer must remain the same and the item must maintain isEqual(_:) sameness. The view gets data from a data source (see NSOutlineViewDataSource). The view retrieves only the data that needs to be displayed. important: It is possible that your data source methods for populating the outline view may be called before awakeFromNib() if the data source is specified in Interface Builder. You should defend against this by having the data source’s outlineView(_:numberOfChildrenOfItem:) method return 0 for the number of items when the data source has not yet been configured. In awakeFromNib(), when the data source is initialized you should always call reloadData(). For more information about using NSOutlineView in your app, see Navigating Hierarchical Data Using Outline and Split Views. Subclassing Subclassing NSOutlineView is not recommended. Customization can be accomplished in your data source class implementation (conforming to NSOutlineViewDataSource) or your delegate class implementation (conforming to NSOutlineViewDelegate).

## Topics

### Accessing the Data Source

- [dataSource](appkit/nsoutlineview/datasource.md)
- [stronglyReferencesItems](appkit/nsoutlineview/stronglyreferencesitems.md)

### Working with Expandability

- [isExpandable(_:)](appkit/nsoutlineview/isexpandable(_:).md)
- [isItemExpanded(_:)](appkit/nsoutlineview/isitemexpanded(_:).md)

### Expanding and Collapsing the Outline

- [expandItem(_:)](appkit/nsoutlineview/expanditem(_:).md)
- [expandItem(_:expandChildren:)](appkit/nsoutlineview/expanditem(_:expandchildren:).md)
- [collapseItem(_:)](appkit/nsoutlineview/collapseitem(_:).md)
- [collapseItem(_:collapseChildren:)](appkit/nsoutlineview/collapseitem(_:collapsechildren:).md)

### Redisplaying Information

- [reloadItem(_:)](appkit/nsoutlineview/reloaditem(_:).md)
- [reloadItem(_:reloadChildren:)](appkit/nsoutlineview/reloaditem(_:reloadchildren:).md)

### Converting Between Items and Rows

- [item(atRow:)](appkit/nsoutlineview/item(atrow:).md)
- [row(forItem:)](appkit/nsoutlineview/row(foritem:).md)

### Working with the Outline Column

- [outlineTableColumn](appkit/nsoutlineview/outlinetablecolumn.md)
- [autoresizesOutlineColumn](appkit/nsoutlineview/autoresizesoutlinecolumn.md)

### Working with Indentation

- [level(forItem:)](appkit/nsoutlineview/level(foritem:).md)
- [level(forRow:)](appkit/nsoutlineview/level(forrow:).md)
- [indentationPerLevel](appkit/nsoutlineview/indentationperlevel.md)
- [indentationMarkerFollowsCell](appkit/nsoutlineview/indentationmarkerfollowscell.md)

### Working with Persistence

- [autosaveExpandedItems](appkit/nsoutlineview/autosaveexpandeditems.md)

### Supporting Drag and Drop

- [setDropItem(_:dropChildIndex:)](appkit/nsoutlineview/setdropitem(_:dropchildindex:).md)
- [shouldCollapseAutoExpandedItems(forDeposited:)](appkit/nsoutlineview/shouldcollapseautoexpandeditems(fordeposited:).md)

### Getting Related Items

- [parent(forItem:)](appkit/nsoutlineview/parent(foritem:).md)
- [childIndex(forItem:)](appkit/nsoutlineview/childindex(foritem:).md)
- [child(_:ofItem:)](appkit/nsoutlineview/child(_:ofitem:).md)
- [numberOfChildren(ofItem:)](appkit/nsoutlineview/numberofchildren(ofitem:).md)

### Getting the Frame for a Cell

- [frameOfOutlineCell(atRow:)](appkit/nsoutlineview/frameofoutlinecell(atrow:).md)

### Accessing the Delegate

- [delegate](appkit/nsoutlineview/delegate.md)

### Manipulating Items

- [insertItems(at:inParent:withAnimation:)](appkit/nsoutlineview/insertitems(at:inparent:withanimation:).md)
- [moveItem(at:inParent:to:inParent:)](appkit/nsoutlineview/moveitem(at:inparent:to:inparent:).md)
- [removeItems(at:inParent:withAnimation:)](appkit/nsoutlineview/removeitems(at:inparent:withanimation:).md)

### User Interface Layout Direction

- [userInterfaceLayoutDirection](appkit/nsoutlineview/userinterfacelayoutdirection.md)

### Constants

- [Drop on Item Index](appkit/drop-on-item-index.md)
- [Outline View Button Keys](appkit/outline-view-button-keys.md)

### Notifications

- [columnDidMoveNotification](appkit/nsoutlineview/columndidmovenotification.md)
- [columnDidResizeNotification](appkit/nsoutlineview/columndidresizenotification.md)
- [itemDidCollapseNotification](appkit/nsoutlineview/itemdidcollapsenotification.md)
- [itemDidExpandNotification](appkit/nsoutlineview/itemdidexpandnotification.md)
- [itemWillCollapseNotification](appkit/nsoutlineview/itemwillcollapsenotification.md)
- [itemWillExpandNotification](appkit/nsoutlineview/itemwillexpandnotification.md)
- [selectionDidChangeNotification](appkit/nsoutlineview/selectiondidchangenotification.md)
- [selectionIsChangingNotification](appkit/nsoutlineview/selectionischangingnotification.md)

### Structures

- [NSOutlineView.ColumnDidMoveMessage](appkit/nsoutlineview/columndidmovemessage.md)
- [NSOutlineView.ColumnDidResizeMessage](appkit/nsoutlineview/columndidresizemessage.md)
- [NSOutlineView.ItemDidCollapseMessage](appkit/nsoutlineview/itemdidcollapsemessage.md)
- [NSOutlineView.ItemDidExpandMessage](appkit/nsoutlineview/itemdidexpandmessage.md)
- [NSOutlineView.ItemWillCollapseMessage](appkit/nsoutlineview/itemwillcollapsemessage.md)
- [NSOutlineView.ItemWillExpandMessage](appkit/nsoutlineview/itemwillexpandmessage.md)
- [NSOutlineView.SelectionDidChangeMessage](appkit/nsoutlineview/selectiondidchangemessage.md)
- [NSOutlineView.SelectionIsChangingMessage](appkit/nsoutlineview/selectionischangingmessage.md)

## Relationships

### Inherits From

- [NSTableView](appkit/nstableview.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSAccessibilityElementProtocol](appkit/nsaccessibilityelementprotocol.md)
- [NSAccessibilityGroup](appkit/nsaccessibilitygroup.md)
- [NSAccessibilityOutline](appkit/nsaccessibilityoutline.md)
- [NSAccessibilityProtocol](appkit/nsaccessibilityprotocol.md)
- [NSAccessibilityTable](appkit/nsaccessibilitytable.md)
- [NSAnimatablePropertyContainer](appkit/nsanimatablepropertycontainer.md)
- [NSAppearanceCustomization](appkit/nsappearancecustomization.md)
- [NSCoding](foundation/nscoding.md)
- [NSDraggingDestination](appkit/nsdraggingdestination.md)
- [NSDraggingSource](appkit/nsdraggingsource.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTextDelegate](appkit/nstextdelegate.md)
- [NSTextViewDelegate](appkit/nstextviewdelegate.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)
- [NSUserInterfaceValidations](appkit/nsuserinterfacevalidations.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### View

- [Navigating Hierarchical Data Using Outline and Split Views](appkit/navigating-hierarchical-data-using-outline-and-split-views.md)
