SwiftUI recursive list with children: programmatically expand nodes

I have a SwiftUI recursive list, created with the (children:) initializer, just like it's shown in the code example here: https://developer.apple.com/documentation/SwiftUI/List#Creating-hierarchical-lists

I would like this tree view to be searchable (i.e a user enters a query into a text field and it searches the entire tree at all levels). Displaying a search result which is not at the top level would require its parents to be programmatically expanded.

How to programmatically expand certain levels of such a list?

SwiftUI recursive list with children: programmatically expand nodes
 
 
Q