I try use dropDestination(payloadType: String.self) in iOS 16 instead of .onDrop(of: [.plainText], ..., in iOS 15, but it doesn't work and I have
SWIFT TASK CONTINUATION MISUSE: loadTransferable(for:) leaked its continuation!
import SwiftUI
struct ContentView: View {
@State var text: String = "🍌🍌"
var body: some View {
HStack {
// Text to drag
Text(text)
.font(.title)
.draggable(text)
/* .onDrag { NSItemProvider(object: self.text as NSItemProviderWriting) }*/
// Area to drop
RoundedRectangle(cornerRadius: 10)
.frame(width: 150, height: 150)
.dropDestination(payloadType: String.self) { (strings: [String], location) in
self.text = "Dropped My Bananas 🍌🍌!"
return true
}
/* .onDrop(of: [.plainText], isTargeted: nil, perform: { _ in
self.text = "Dropped My Bananas 🍌🍌!"
return true
})*/
}
}
}
What wrong with my code?