Skip to content

Instantly share code, notes, and snippets.

@brunomunizaf
Created November 19, 2020 06:27
Show Gist options
  • Save brunomunizaf/9d32e64bb81a21dc5362821d1e0a3741 to your computer and use it in GitHub Desktop.
Save brunomunizaf/9d32e64bb81a21dc5362821d1e0a3741 to your computer and use it in GitHub Desktop.
import UIKit
final class Presenter: NSObject, UIViewControllerTransitioningDelegate {
private let transition = Transition()
func present(_ viewController: UIViewController, from parent: UIViewController) {
viewController.modalPresentationStyle = .overFullScreen
viewController.transitioningDelegate = self
parent.present(viewController, animated: true)
}
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
transition.direction = .present
return transition
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
transition.direction = .dismiss
return transition
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment