Skip to content

Instantly share code, notes, and snippets.

@brunomunizaf
Last active June 6, 2019 01:47
Show Gist options
  • Select an option

  • Save brunomunizaf/88383cf062c54ee3178a99fc9fd4fd2c to your computer and use it in GitHub Desktop.

Select an option

Save brunomunizaf/88383cf062c54ee3178a99fc9fd4fd2c to your computer and use it in GitHub Desktop.
AnimatedTransitioning
class ViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(tappedImage))
imageView.isUserInteractionEnabled = true
imageView.addGestureRecognizer(tapRecognizer)
}
@objc func tappedImage() {
let transitionAnimator = TransitionDelegate()
navigationController?.delegate = transitionAnimator
let otherVC = OtherViewController(nibName: String(describing: OtherViewController.self), bundle: Bundle.main)
navigationController?.pushViewController(otherVC, animated: true)
}
}
// MARK: - AnimatedTransition
extension ViewController: AnimatedTransition {
func imageView(for transition: TransitionDelegate) -> UIImageView? {
return imageView
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment