Bad: OutlineGroup is not lazy loading children?

This appears to severely limit the usefulness of hierarchical lists in SwiftUI.

I want to use the new hierarchical list/outline to display a filesystem tree. For data to pass to OutlineGroup, I created a class named FileSystemNode, and gave it a computed children property. When the getter is first called, it will read its directory contents to return a list (if it is a directory).

Problem is, when the OutlineGroup is first displayed, even though it is collapsed on-screen to a single node, it calls children and recurses over the entire filesystem.

Is there a way to stop this? If not, I hope it gets fixed before release.

(This is on macOS Big Sur beta)
I filed a Feedback about it: FB8782243.


Hello,

Did you ever receive a response to this? It seems to still be the situation (Monterey 12.4). I've tried a few approaches but I've not found anything satisfactory. This approach using DisclosureGroup doesn't seem to function correctly for even modestly deep lists and sometimes doesn't properly open or close.

I created an OutlineView package here: https://github.com/EncodiaDotCo/OutlineView to address this.

It's the first time I've created a public github repo for a Swift package, so hopefully it's usable.

It's not pretty yet but it lazy loads children. Maybe we can cooperate and improve it. Feel free to create bug/feature requests.

Bad: OutlineGroup is not lazy loading children?
 
 
Q