- Swift 4.0 / Xcode 9
OS X 10.9 or later iOS 8.0 or later watchOS 2.0 or later tvOS 9.0 or later
Still wanna use swift2.2 or 2.3?
-> You can use 0.5.0 instead.
iOS8 or later
# Podfile
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'RAReorderableLayout'
end
# Cartfile
github "ra1028/RAReorderableLayout"
Setup your collection view to use RAReorderableLayout.
You must reorder cells information array in RAReorderableLayoutDelegate protocol to support reordering capability.
Specifically, please refer to Demo-project.
Delegate
optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, willMoveToIndexPath toIndexPath: NSIndexPath)
optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, didMoveToIndexPath toIndexPath: NSIndexPath)
optional func collectionView(collectionView: UICollectionView, allowMoveAtIndexPath indexPath: NSIndexPath) -> Bool
optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, canMoveToIndexPath: NSIndexPath) -> Bool
optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, willBeginDraggingItemAtIndexPath indexPath: NSIndexPath)
optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, didBeginDraggingItemAtIndexPath indexPath: NSIndexPath)
optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, willEndDraggingItemToIndexPath indexPath: NSIndexPath)
optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, didEndDraggingItemToIndexPath indexPath: NSIndexPath)
Datasource
optional func collectionView(collectionView: UICollectionView, reorderingItemAlphaInSection section: Int) -> CGFloat
optional func scrollTrigerEdgeInsetsInCollectionView(collectionView: UICollectionView) -> UIEdgeInsets
optional func scrollTrigerPaddingInCollectionView(collectionView: UICollectionView) -> UIEdgeInsets
optional func scrollSpeedValueInCollectionView(collectionView: UICollectionView) -> CGFloat
RAReorderableLayout is available under the MIT license. See the LICENSE file for more info.