Instance Method

outlineView(_:child:ofItem:)

Returns the child item at the specified index of a given item.

Declaration

optional func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any

Parameters

outlineView

The outline view that sent the message.

index

The index of the child item from item to return.

item

An item in the data source.

Return Value

The child item at index of item. If item is nil, returns the appropriate child item of the root object.

Discussion

Children of a given parent item are accessed sequentially. In order for the collapsed state of the outline view to remain consistent when it is reloaded you must always return the same object for a specified child and item.

Special Considerations

The outlineView(_:child:ofItem:) method is called very frequently, so it must be efficient.

See Also