Realized a bit ago I forgot to include the code which sets topLevelSectionIndex. It was in a block of debug prints which I trimmed from the code above:
Swift
let topLevelSectionIndex:Int? = {
for (index, section) in objectSections.enumerated() {
if controller == section.frc { return index }
}
return nil
}()
let myOutlineView:NSOutlineView = myScrollView.documentView! as! NSOutlineView
switch type {
...
I tried adding this code to my case .insert: just above the insertItems:
Swift
print("Parent is expandable? \(myOutlineView.isExpandable(parent))")
print("Parent is expanded? \(myOutlineView.isItemExpanded(parent))")
myOutlineView.expandItem(parent)
print("Parent is expanded? \(myOutlineView.isItemExpanded(parent))")
and it gave me this in my logs:
text
Parent is expandable? true
Parent is expanded? false
Parent is expanded? false
I get the same results whether the supercategory is expanded or collapsed before I download my data and my code is called. This makes me think the parent object I'm getting isn't the parent object the NSOutlineView wants me to use.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: