-
Notifications
You must be signed in to change notification settings - Fork 0
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)
- UPDATE: Apple support says that the new field
stronglyReferencesItems
on 10.12 fixes this. I haven't tested it.