I'm trying to populate an NSOutlineView
with Swift structs as its items. This works, except for the row(forItem:)
method, which always returns -1.
I've made sure my struct conforms to Equatable
and I implemented an isEqual
function. Still the NSOutlineView
can not find the row for any item.
If I convert my struct to a class (not derived from NSObject), it all works. Even without conforming to Equatable
or implementing any isEqual
functions.
I thought classes and structs in Swift are basically the same except one being a reference type and the other a value type.
What do I need to implement to use Swift structs as items in an NSOutlineView
?