Reputation: 3464
I have an NSOutlineView. I've set the delegate and data source. It displays all data correctly after I do outlineView.reloadData()
You could picture my outline view like this:
Room A
- Ash
- Brock
Room B
- Misty
- Professor Oak
I do some editing to the data (not to the outlineView) and move "Misty" to Room A.
Room A
- Ash
- Brock
- Misty
Room B
- Professor Oak
After I do outlineView.reloadData()
, it shows the updated data correctly.
Then, I change
outlineView.reloadData()
with
outlineView.moveItem(at: 0, inParent: room[1], to: 2, inParent: room[0])
But nothing happens. I checked the data source, and the data source wasn't called. It's only called if I do outlineView.reloadData()
.
I also tried to do outlineView.reloadItem()
and it also didn't work.
Any idea why outlineView.moveItem()
doesn't work?
Upvotes: 0
Views: 252
Reputation: 3464
I can't believe how unreliable Cocoa / Appkit framework is compared to UIKit.
The reason why the moveItem()
doesn't work is because the NSOutlineView only supports Objective-C NSObject. You can't use plain Swift class for the NSOutlineView's item object.
Upvotes: 0