The behavior of onDrag and onDrop in iOS 18 is different from previous versions.

I am developing an app that supports iOS 15 and later.

Up until iOS 17, the behavior of onDrag and onDrop was as follows:

  1. The item is moved by holding it and dragging it to the onDrop area.
  2. When the item is dropped in the onDrop area, the logic is executed, and simultaneously, the item disappears immediately.
  3. However, in iOS 18 the item remains for about 0.5 to 1.0 seconds before disappearing, even though there is no logic in the onDrop.

Is this the expected behavior, or is it a bug?"

Hwangho, can you please file a feedback with a project or a code snippet that reproduces the issue?

Ok, here is the snippet.

import SwiftUI

struct ContentView: View {  
   @State var str: String = "Drag me"

   var body: some View {
   VStack(spacing: 100) {
  
      Text(str)
       .frame(width: 100, height: 100)
       .background(.blue)
       .onDrag {
          NSItemProvider(object: String(str) as NSString)
       }
  
      VStack {
        Text("Drop Here!")
      }
      .frame(width: 200, height: 200)
      .background(.red)
      .onDrop(of: [.text], delegate: MyDelegate())
   }
  }
}

struct MyDelegate: DropDelegate {
    func performDrop(info: DropInfo) -> Bool {
        return true
    }
}

#Preview {
 ContentView()
}
The behavior of onDrag and onDrop in iOS 18 is different from previous versions.
 
 
Q