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

swift3 - Duplicated items problem #50

@fatihyildizhan

Description

@fatihyildizhan

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)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions