I've put together a somewhat simple app to demonstrate drag and drop using .draggable and .dropDestination. I'm using a simple custom object with two strings and two enums as properties. I have followed all the steps for UTType and implementing Transferrable. I have two views displayed from the ContentView. The left side is a List with four of my custom objects (a user). The user is a "card" I implemented in a separate imbedded view. The right side is a drop area which is a ZStack with a List inside which displays an array of users dropped onto the ZStack.
The draggable seems to be working fine. I can drag a user "card" around. The drop doesn't work. I have the .dropDestination on the ZStack and the initial closure on the .dropDestination doesn't seem to fire. I placed a print() in both closures and the print() in the first closure never prints. The "isTargeted:" closure does fire (a little unreliably) on the iPhone simulator and (less reliably) on the iPad.
Post
Replies
Boosts
Views
Activity
System Data taking up 388 gb on macOS 12.0 (21A5304g)
Anybody know of a fix for this?
I'm on an MacBook Pro with an M1.