SwiftUI: Dropping a list row 'into' another list row

Viewed 150

I want to recreate the drag and drop of rows in the Files app. So when I drag a list{} row onto another list row, I want it to acknowledge which row it's being dragged over and then be able to execute a function (like entering the row.)

I've tried attaching any .onDrops, but none work.

  .onDrop(of: [UTType.content], isTargeted: nil) { _, _ in
    print("Dropped \(header)")}

Also a dropdelegate does nothing. It never acknowledges that I want to drop anything at all, it immediately switches over to the onInsert.

A gif of how the built in iPadOS/iOS files app does it.

enter image description here

1 Answers
Related