You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.0 KiB
124 lines
3.0 KiB
![]()
1 year ago
|
# TableViewDragger
|
||
|
|
||
|
[](https://github.com/Carthage/Carthage)
|
||
|
[](http://cocoadocs.org/docsets/TableViewDragger)
|
||
|
[](http://cocoadocs.org/docsets/TableViewDragger)
|
||
|
[](http://cocoadocs.org/docsets/TableViewDragger)
|
||
|
|
||
|

|
||
|
|
||
|
This is a demo that uses a `TableViewDragger`.
|
||
|
|
||
|
#### [Appetize's Demo](https://appetize.io/app/p92e7wrmfkq32t473fuavn8bmm)
|
||
|
|
||
|
## Requirements
|
||
|
|
||
|
- Swift 4.2
|
||
|
- iOS 8.0 or later
|
||
|
|
||
|
## How to Install TableViewDragger
|
||
|
|
||
|
#### CocoaPods
|
||
|
|
||
|
Add the following to your `Podfile`:
|
||
|
|
||
|
```Ruby
|
||
|
pod "TableViewDragger"
|
||
|
```
|
||
|
|
||
|
#### Carthage
|
||
|
|
||
|
Add the following to your `Cartfile`:
|
||
|
|
||
|
```Ruby
|
||
|
github "KyoheiG3/TableViewDragger"
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
### TableViewDragger Variable
|
||
|
|
||
|
```swift
|
||
|
weak var delegate: TableViewDraggerDelegate?
|
||
|
```
|
||
|
* Delegate of `TableViewDragger`.
|
||
|
|
||
|
```swift
|
||
|
weak var dataSource: TableViewDraggerDataSource?
|
||
|
```
|
||
|
* DataSource of `TableViewDragger`.
|
||
|
|
||
|
```swift
|
||
|
var isHiddenOriginCell: Bool
|
||
|
```
|
||
|
* It will be `true` if want to hide the original cell.
|
||
|
* Default is `true`.
|
||
|
|
||
|
```swift
|
||
|
var zoomScaleForCell: CGFloat
|
||
|
```
|
||
|
* Zoom scale of cell in drag.
|
||
|
* Default is `1`.
|
||
|
|
||
|
```swift
|
||
|
var alphaForCell: CGFloat
|
||
|
```
|
||
|
* Alpha of cell in drag.
|
||
|
* Default is `1`.
|
||
|
|
||
|
```swift
|
||
|
var opacityForShadowOfCell: Float
|
||
|
```
|
||
|
* Opacity of cell shadow in drag.
|
||
|
* Default is `0.4`.
|
||
|
|
||
|
```swift
|
||
|
var scrollVelocity: CGFloat
|
||
|
```
|
||
|
* Velocity of auto scroll in drag.
|
||
|
* Default is `1`.
|
||
|
|
||
|
### TableViewDragger Function
|
||
|
|
||
|
```swift
|
||
|
init(tableView: UITableView)
|
||
|
```
|
||
|
* `UITableView` want to drag.
|
||
|
|
||
|
### TableViewDraggerDataSource Function
|
||
|
|
||
|
```swift
|
||
|
optional func dragger(_ dragger: TableViewDragger, cellForRowAt indexPath: IndexPath) -> UIView?
|
||
|
```
|
||
|
* Return any cell if want to change the cell in drag.
|
||
|
|
||
|
```swift
|
||
|
optional func dragger(_ dragger: TableViewDragger, indexPathForDragAt indexPath: IndexPath) -> IndexPath
|
||
|
```
|
||
|
* Return the indexPath if want to change the indexPath to start drag.
|
||
|
|
||
|
### TableViewDraggerDelegate Function
|
||
|
|
||
|
```swift
|
||
|
func dragger(_ dragger: TableViewDragger, moveDraggingAt indexPath: IndexPath, newIndexPath: IndexPath) -> Bool
|
||
|
```
|
||
|
* If allow movement of cell, please return `true`. require a call to `moveRowAtIndexPath:toIndexPath:` of UITableView and rearranged of data.
|
||
|
|
||
|
```swift
|
||
|
optional func dragger(_ dragger: TableViewDragger, shouldDragAt indexPath: IndexPath) -> Bool
|
||
|
```
|
||
|
* If allow dragging of cell, prease return `true`.
|
||
|
|
||
|
## Author
|
||
|
|
||
|
#### Kyohei Ito
|
||
|
|
||
|
- [GitHub](https://github.com/kyoheig3)
|
||
|
- [Twitter](https://twitter.com/kyoheig3)
|
||
|
|
||
|
Follow me 🎉
|
||
|
|
||
|
## LICENSE
|
||
|
|
||
|
Under the MIT license. See LICENSE file for details.
|