Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 866 Bytes

File metadata and controls

32 lines (22 loc) · 866 Bytes

[DEPRECEATED] Since iOS13 this is build-in feature

Simple Interactive Transitions using UIViewPropertyAnimator

Since iOS10 UIViewPropertyAnimator gives us an amazing tool to make UIView animations interactive. this project is simple experiment, feel free to extend and customize - it is very simple!

  1. Copy InteractiveDismissing class to your project
  2. Conform ypour modal viewciontroller to the InteractiveDismissing protocol
var animator: UIViewPropertyAnimator?
  1. Add UIPanGestureRecognizer to your view
let panGesture = UIPanGestureRecognizer(target: self, action: #selector(ModalViewController.didTrackPanGesture))
view.addGestureRecognizer(panGesture)
  1. In your gesture handler simply call:
dismissInteractively(with: sender) {
	self.dismiss(animated: false, completion: nil)
}
  1. Done.