Post

Replies

Boosts

Views

Activity

Reply to SwiftUI OutlineGroup Customizing
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).
Sep ’22
Reply to ContextMenu of List stops working when applying custom DisclosureGroupStyle in macOS
I figured it out (after having tried for several days before posting this question...): When .contentShape(Rectangle()) is removed, the contextMenu works again in macOS as well. However, with this, the user cannot expand/collapse items by clicking on the item itself anymore (which, luckily, this isn't an issue in my case clicking an item should select/unselect it). Given the above-mentioned .contentShape(Rectangle()) is also included in Apple's official DisclosureGroupStyle example and given that contextMenu is only invoked by right clicks, thus, left klicks should still be possible, I'd say this behaviour can be considered a bug.
Oct ’22