How to rearrange cells in collection view for apps written prior to iOS9.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
MovingCells.xcodeproj made swift3 compatible Apr 14, 2017
MovingCells made swift3 compatible Apr 14, 2017
.gitignore Initial commit Apr 25, 2016
LICENSE Initial commit Apr 25, 2016
README.md Update README.md Apr 25, 2016

README.md

MovingCells

This example project aims to get the same effect of what UIKit does when rearranging cells.

The following methods were introduced as of iOS9 so are unavailable for apps written in iOS7.x and iOS8.x

    @available(iOS 9.0, *)
    optional public func collectionView(collectionView: UICollectionView, canMoveItemAtIndexPath indexPath: NSIndexPath) -> Bool

    @available(iOS 9.0, *)
    optional public func collectionView(collectionView: UICollectionView, moveItemAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)
    
    @available(iOS 9.0, *)
    public func beginInteractiveMovementForItemAtIndexPath(indexPath: NSIndexPath) -> Bool // returns NO if reordering was prevented from beginning - otherwise YES

    @available(iOS 9.0, *)
    public func updateInteractiveMovementTargetPosition(targetPosition: CGPoint)

    @available(iOS 9.0, *)
    public func endInteractiveMovement()

    @available(iOS 9.0, *)
    public func cancelInteractiveMovement()

which forces us to find a way to rearranage cells in a collection view with a smooth animation.

Screenshot of Rearranging cells

Implemented based on the following Stackoverflow question:

http://stackoverflow.com/questions/36821289/reordering-uicollectionview-in-ios7