SwiftUI OutlineGroup Customizing

Question A

Has somebody figured out how to customize the inset for (disclosed) children views in OutlineGroup?

Question B

Has somebody figured out how to make children in an OutlineGroup appear as "parent" (i.e. inset = 0)?

Question C

How to manipulate the visual appearance of the ("opened") parent in a disclosed OutlineGroup (i.e. show a different image, highlight something etc.?

https://developer.apple.com/documentation/swiftui/outlinegroup


Late to the game, but it looks like you could achieve A and B with a custom DisclosureGroupStyle introduced in OS 16.0/macOS 13.0 (see example on linked page).

FYI: In my case, I was loading recursive data into a List using the following code (excerpt)

List(data, children: \.children) {node in }

Here, I had to add .disclosureGroupStyle(MyDisclosureStyle()) twice, to the List itself as well as to its parent view to get it working for all nested levels (and not only the the first level).

You can apply your custom disclosure style to to the configuration.content that you call within your custom disclosure style makeBody.

                configuration
                    .content
                .disclosureGroupStyle(CustomDisclosureStyle())
            }
SwiftUI OutlineGroup Customizing
 
 
Q