Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 822 Bytes

readme.md

File metadata and controls

24 lines (18 loc) · 822 Bytes

#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