Skip to content

BayPhillips/draggable-swift

Repository files navigation

#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

About

Easily make things draggable!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages