ela

Elastic

Fancy elastic transition powered by Metal, UIKit Dynamics, & Hero

Showing:

Popularity

Downloads/wk

0

GitHub Stars

151

Maintenance

Last Commit

5yrs ago

Contributors

1

Package

Dependencies

1

License

MIT

Categories

Readme

Elastic

Carthage compatible Version License Xcode 8.2+ iOS 8.0+ Swift 3.0+

Fancy elastic transition powered by Metal, UIKit Dynamics, & Hero:

Just a proof of concept inspired by Álvaro Carreras's Slide Concept. Not really optimized and does not support older devices. You should not use this in production. If you want something similar, checkout ElasticTransition

Supports UINavigationController, UITabBarController, & Modal Present. Since it is powered by Hero, the other views can still benefit from animations constructed by Hero.

Requirements

  • Xcode 8.2
  • Swift 3.0.2
  • Metal compatible devices (iPhone 5s or newer)

Won't work on simulator.

Installation

pod "Elastic"

Usage

  override func viewDidLoad() {
    super.viewDidLoad()
    // 1. Enable the plugin
    ElasticHeroPlugin.isEnabled = true
    
    // 2. setup a gesture recognizer
    let leftGR = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(pan(gr:)))
    leftGR.edges = UIRectEdge.left
    view.addGestureRecognizer(leftGR)
    
    // 3. set the heroModifier of the elastic view to be
    view.heroModifiers = [.elastic(edge: .left, gestureRecognizer: leftGR)]
  }
    
  func pan(gr:UIScreenEdgePanGestureRecognizer){
    if gr.state == .began {
      // 4. perform your transition when the gesture recognizer begans. the rest will be handled automatically
      performSegue(withIdentifier: "next", sender: nil)
    }
  }

The elastic view doesn't have to be the gesture recognizer's view. For example, the following code makes the next view controller's view elastic.

  // This replaces step 3
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    let vc = segue.destination
    vc.view.heroModifiers = [.elastic(edge: .right, gestureRecognizer: rightGR)]
  }

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100