Post

Replies

Boosts

Views

Activity

Drag (and drop) in SwiftUI List with children on macOS
I can't seem to figure out how to enable drag and drop on (selected) entries in a SwiftUI tree List (using the children) parameter in a macOS app. List(entries, id: \.self, children: \.children, selection: $selectedEntries, rowContent: {     Row(entry: $0) }) Adding .onDrag (returning an NSItemProvider) to the list does nothing, adding it to a Row seems to cancel the selection gesture and is not really what I want as I would like to drag all selected rows at once. From what I could find, only the ForEach supports .onMove, but I cannot use the ForEach as this cannot be combined with the List's children parameter and I am not sure if that would allow me to drag anything outside the app's window. By now I am thinking of going back to NSOutlineView (or, worse, modify the one SwiftUI uses), so I really could use some help here. Thanks.
2
0
2k
Oct ’20