Skip to content

skydice/View-Handle-Protocol

Repository files navigation

View-Handle-Protocols

Swift 3.0.x platforms

By simply adding a protocol, you can make your view in movable, resizable, rescalable, and rotatable way.

How It Works

movable, resizable, rescalable and rotatable protocol exposes the functionality to the view classes that conform to it, using protocol extensions.

Example

With very little boilerplate, any subclass of UIView can conform to it.

class MovableView: UIView, Movable {
    public lazy var movableHelper: MovableHelper? = {
        return MovableHelper(view: self)
    }()
    
    public lazy var ResizableHelper: ResizableHelper? = {
        return ResizableHelper(view: self)
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.addMovable()
        self.addResizable()
    }
}

Compatibility

  • iOS 9.0+
  • Swift 3.0
  • Xcode 8.0

License

  • See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published