I am trying to enable drag and drop within my app as a mechanism for triggering a function. I have a TableView that displays a list of users and I have a collectionView that can display 3 distinct types of data - but only 1 type at a time.
I want the collectionView to accept the "drop" from the tableView when it is displaying Type1 data and Type3 data, but not for Type2 data. Right now, my drag and drop is working - but it is working for all 3 data types and I don't want it to work for Type2 data.
So currently, the action I trigger just ignores the dropped data if it is displaying Type2 data - but I would like to prevent the CollectionView from even accepting it (if possible). I don't want the users to see the visual indication that a drop is possible.
I suspect that I should be using the dropProposal for this - but after reading the Apple docs and multiple hours of searching with Google and YouTube for examples - I'm at a complete loss.
I do know I'm supposed to post my broken code here with my question, but the only thing I've even thought of to try and control this was to manipulate the collectionView.dropDelegate based on the data type I was displaying. I'm fairly confident that the correct solution will be very different - but here's what I tried:
if collectionMode != "Type2" {
collectionView.dropDelegate = self
} else {
collectionView.dropDelegate = nil
}
If you can help point me to the answer, please do.
Try this,