If you drag the B and drop left to the A, you'll get two A's. This problem occurs on demo and actual project.
// current:
func collectionView(_ collectionView: UICollectionView, at: IndexPath, didMoveTo toIndexPath: IndexPath) {
let book = books.remove(at: (toIndexPath as NSIndexPath).item)
books.insert(book, at: (toIndexPath as NSIndexPath).item)
}
// fixed: Is this the right solution ?
func collectionView(_ collectionView: UICollectionView, at: IndexPath, didMoveTo toIndexPath: IndexPath) {
let book = books.remove(at: (at as NSIndexPath).item)
books.insert(book, at: (toIndexPath as NSIndexPath).item)
}
If you drag the B and drop left to the A, you'll get two A's. This problem occurs on demo and actual project.