ElasticTransition (Swift 3)
A UIKit custom modal transition that simulates an elastic drag. Written in Swift.
Thanks to Matt Garnett (@c-o-l-o-r) for converting ElasticTransition to Swift 3
Also, special thanks to @taglia3 for developing the [Objective-C version] (https://github.com/taglia3/ElasticTransition-ObjC). Check it out!
Requirements
- Xcode 8 or higher
- iOS 8.0 or higher
- Swift 3.0
Installation
CocoaPods
Usage
Simple
Attributes you can set:
Advance Usage
This work with any view controller.
In prepareForSegue, assign the transition to be the transitioningDelegate of the destinationViewController.
Also, dont forget to set the modalPresentationStyle to .Custom
(Optional) In your modal view controller implement the ElasticMenuTransitionDelegate and provide the contentLength
Interactive transition for modal transition
First, construct a pan gesture recognizer
Then implement your gesture handler and fo the following:
Interactive transition for dismissing the modal
- Implement ElasticMenuTransitionDelegate in your modal view controller and set
- Or use your own panGestureRecognizer and call dissmissInteractiveTransition in your handler