Skip to content

A tiny tool to provide draggable function to any UIView

License

Notifications You must be signed in to change notification settings

vince-hz/ViewDragger

Repository files navigation

ViewDragger

Version License Platform

Setup forwards superView and backwards superView.Then you can drag view backwards and forwards. This is an alternative to modal viewController with transition animation.

When user drag the animation view, the dragger lifts the view to the window level.When the drag ended, the dragger will place the animation view to the right place.

All you have to care is the backwards view and forwards view. Also backwards frame and forwards frame needs to be set.

Example

let dragger = ViewDragger(animationView: aView, // the view need drag animation
                          backwardsSuperView: aBackwardsSuperView, // the original superview
                          forwardSuperView: aForwardsSuperView, // forwards animation superview
                          backwardsViewFrame: aBackwardsFrame, // the orginal frame
                          forwardsViewFrame: aForwardsFrame, // forwards animation end frame
                          gestureAxis: .horizontal) // or .vertical

Installation

ViewDragger is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ViewDragger'

License

ViewDragger is available under the MIT license. See the LICENSE file for more info.

About

A tiny tool to provide draggable function to any UIView

Resources

License

Stars

Watchers

Forks

Packages

No packages published