개발/swift
Swift drag, drop and reorder collectionView Cell
lemonade
2020. 12. 4. 10:00
반응형
How to drag and drop collectionView Cell?
You can use dragDelegate and dropDelegate!
First, set delegate!
Second, implement drag method!
Note that replace item with your own cell item!
Now you can drag your cell!
Finally, implement drop method!
DropSessionDidUpdate method returns a UICollectionViewDropProposal. This is how we tell the DropDelegate that something is happening when the user drags a cell and drops it at a new location.
In performDropWith method, you should reorder your data list too.
Now you can reorder cell by drag, drop action!!
Happy Codding :)
반응형