There is no issue with triggering onDrag when long-pressing for the first time. However, if the user releases their finger and the DropDelegate determines this is not a valid drop operation, it will not trigger a view update. In this case, when the user long-presses the same view again, the onDrag method will not be triggered even though the floating Preview view is already displayed under the finger. The problem will not recur if the DropDelegate updates the view (such as swapping the positions of views). The same code works without issues on iOS 18.
The problem can be reproduced with simple code like the following:
struct ContentView: View {
var body: some View {
Rectangle()
.fill(.blue)
.onDrag {
print("OnDrag")
return NSItemProvider()
}
}
}
The "OnDrag" log will only be output once.