Skip to content

A UICollectionView which allows for easy drag and drop to reorder cells. Mimicks the drag and drop on the iOS Springboard when reordering apps (wiggle animation included!). AutoScroll included also

Notifications You must be signed in to change notification settings

Lior539/DragDropCollectionView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DragDropCollectionView

A UICollectionView which allows for easy drag and drop to reorder cells. Mimicks the drag and drop on the iOS Springboard when reordering apps (wiggle animation included!).

I have also included automatic scrolling for when the collection view's content does not all fit in the frame

Alt text

Installation

To use the DragDropCollectionView class in an app, just drag the DragDropCollectionView.swift file into your project.

Protocols and Delegates

DragDropCollectionView has the following protocol:

@objc protocol DrapDropCollectionViewDelegate: UICollectionViewDelegate

This inherits from UICollectionViewDelegate and is to be used in place of the '.delegate' property found in UICollectionView

DragDropCollectionView has the following delegate:

weak var draggingDelegate: DrapDropCollectionViewDelegate?

The DragDropCollectionViewDelegate has the following required methods:

func dragDropCollectionViewDidMoveCellFromInitialIndexPath(initialIndexPath: NSIndexPath, toNewIndexPath newIndexPath: NSIndexPath)

This method should be used in your to 'swap' items in your datasource

The DragDropCollectionViewDelegate has the following optional methods:

optional func dragDropCollectionViewDraggingDidBeginWithCellAtIndexPath(indexPath: NSIndexPath)
optional func dragDropCollectionViewDraggingDidEndForCellAtIndexPath(indexPath: NSIndexPath)

Methods

Dragging can be easily enabled and disabled using the follwing method:

func enableDragging(enable: Bool)

To start the wiggle animation, use:

func startWiggle()

To stop the wiggle animation, use:

func stopWiggle()

About

A UICollectionView which allows for easy drag and drop to reorder cells. Mimicks the drag and drop on the iOS Springboard when reordering apps (wiggle animation included!). AutoScroll included also

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages