iosswifttransitionuipresentationcontrolleruimodaltransitionstyle

Custom UIModalPresentationStyle.custom: Why does presentationController(forPresented get called but not animationController(forPresented?


I'm using UIModalPresentationStyle.custom.

In my UIViewControllerTransitioningDelegate why does this method get called:

func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController?

But none of these functions get called:

func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning?

func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?

func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

Solution

  • Make sure you set the animated Bool to true when calling

    present(viewController, animated: true, completion: nil)
    

    and

    dismiss(animated: true, completion: nil)