Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

swift3 - Duplicated items problem #50

Open
fatihyildizhan opened this issue Nov 15, 2016 · 1 comment
Open

swift3 - Duplicated items problem #50

fatihyildizhan opened this issue Nov 15, 2016 · 1 comment

Comments

@fatihyildizhan
Copy link

fatihyildizhan commented Nov 15, 2016

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.

order 1

order 2

// 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)
    }
@mjhassan
Copy link

mjhassan commented Dec 7, 2016

@fatihyildizhan, logically your fix seems correct.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants