Skip to content

NSOutlineView

Ken Harris edited this page Feb 6, 2018 · 3 revisions

The docs say in multiple places (here, here) that NSOutlineViewDataSource method outlineView(_:objectValueFor:byItem:) is required, but it's not. It's a remnant of the old NSCell days. If you implement NSOutlineViewDelegate method outlineView(_:viewFor:item:), that's perfectly sufficient. (filed: #36140032)

The NSOutlineViewDataSource interface uses Any as the type that your data source returns. It should be AnyObject. It will seem to work for a little while, until you scroll, and then the system will try to retain your items, and if it's a struct, it'll crash. It doesn't need to be NSObject, but it does need to be a class. (filed: #36143587)

Clone this wiki locally