Easily make things draggable!
Swift
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.
Draggable
DraggableDemo.xcodeproj
DraggableDemo
DraggableDemoTests
DraggableDemoUITests
.gitignore
readme.md

readme.md

#Draggable-Swift

Utilizing Swift 2's protocol extensions, we're able to make any UIView backed class draggable easily by simply adding the Draggable protocol, implementing one property and enabling the gestures:

##Example

class DraggableView: UIView, Draggable
{
    var initialLocation: CGPoint = CGPointZero

    override func didMoveToSuperview() {
        if self.superview != nil {
            self.registerDraggability()
        } else {
            self.removeDraggability()
        }
    }
}

The demo also includes an example for UICollectionViewCell, but this can be applied pretty much anywhere else.

##Screenshots Gif Gif