Hierarchical List / OutlineGroup - can't change data?

Does anyone use the new hierarchical data List (ie, OutlineGroup) with a model where the tree data changes?

I'm on Big Sur beta. I have code like this:

Code Block swift
List([treeRoot], children: \.children) { item in ...


Say the treeRoot (observed object) gets a new child. The view tries to re-render and fails:

2020-09-21 ... [General] NSOutlineView error inserting child indexes <_NSCachedIndexSet: 0x600000760000>[number of indexes: 1 (in 1 ranges), indexes: (3)] in parent 0x0 (which has 1 children).







Replies

I've recently started an app where the content view uses this type of hierarchical list view (with children). I'm able to successfully display the hierarchical list in the content view, and when I tap an item in the hierarchy, I'm successfully able to navigate to a detail view for that tapped item. I'm also able to edit one of the tapped item properties in the detail view using a TextEditor view. However, when I click save in the detail view, the changed property will only be saved if it was the parent list item row that I tapped in the content view. If it was a child list item in the content view, the save does not work. I think I may have a problem in my save code logic and I'm trying to investigate.