Skip to content

A cells of UITableView can be rearranged by drag and drop.

License

Notifications You must be signed in to change notification settings

ushpizin/TableViewDragger

 
 

Repository files navigation

TableViewDragger

Carthage compatible Version License Platform

Demo

This is a demo that uses a TableViewDragger.

Requirements

  • Swift 3.0
  • iOS 7.0 or later

How to Install TableViewDragger

iOS 8+

CocoaPods

Add the following to your Podfile:

use_frameworks!
pod "TableViewDragger"

Note: the use_frameworks! is required for pods made in Swift.

Carthage

Add the following to your Cartfile:

github "KyoheiG3/TableViewDragger"

iOS 7

Just add everything in the TableViewDragger.swift and TableViewDraggerCell.swift file to your project.

Usage

import

If target is ios8.0 or later, please import the TableViewDragger.

import TableViewDragger

TableViewDragger Variable

weak var delegate: TableViewDraggerDelegate?
  • Delegate of TableViewDragger.
weak var dataSource: TableViewDraggerDataSource?
  • DataSource of TableViewDragger.
var originCellHidden: Bool
  • It will be true if want to hide the original cell.
  • Default is true.
var cellZoomScale: CGFloat
  • Zoom scale of cell in drag.
  • Default is 1.
var cellAlpha: CGFloat
  • Alpha of cell in drag.
  • Default is 1.
var cellShadowOpacity: Float
  • Opacity of cell shadow in drag.
  • Default is 0.4.
var scrollVelocity: CGFloat
  • Velocity of auto scroll in drag.
  • Default is 1.

TableViewDragger Function

init(tableView: UITableView)
  • UITableView want to drag.

TableViewDraggerDataSource Function

optional func dragger(dragger: TableViewDragger.TableViewDragger, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell?
  • Return any cell if want to change the cell in drag.
optional func dragger(dragger: TableViewDragger.TableViewDragger, indexPathForDragAtIndexPath indexPath: NSIndexPath) -> NSIndexPath
  • Return the indexPath if want to change the indexPath to start drag.

TableViewDraggerDelegate Function

func dragger(dragger: TableViewDragger.TableViewDragger, moveDraggingAtIndexPath indexPath: NSIndexPath, newIndexPath: NSIndexPath) -> Bool
  • If allow movement of cell, please return true. require a call to moveRowAtIndexPath:toIndexPath: of UITableView and rearranged of data.
optional func dragger(dragger: TableViewDragger.TableViewDragger, shouldDragAtIndexPath indexPath: NSIndexPath) -> Bool
  • If allow dragging of cell, prease return true.

LICENSE

Under the MIT license. See LICENSE file for details.

About

A cells of UITableView can be rearranged by drag and drop.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.0%
  • Ruby 2.1%
  • Objective-C 1.9%