It’s been a while and after some long due time off I’m finally back with a new iOS tutorial.

I wanted to add some more details to my previous post showing you how to implement an interactive transition and that’s exactly what I’m going to do with this article!

This short video shows a preview of what we’re going to create with this tutorial:

Interactive vs Animated transition

The main difference between these two ways of performing a transition is obviously how they progress from start to finish.

With an animated transition we define the timing, the initial and final state with transitionDuration and animateTransition methods of UIViewControllerAnimatedTransitioning. So the animation just runs from 0 to 100% in a pre-defined time. Yes, you could also perform keyframe animation having some more control over the flow, but you still end up with a complete animation cycle, from 0 to 100%.

The interactive transition is a great way to create a synergy with the user. He (or she) becomes the director of the transition, driving the animation flow and cancelling the transition if need be.

Custom transition, quick recap

In my previous post we’ve created a custom transition to present a modal controller essentially following these steps:

1) Creating a UIViewControllerTransitioningDelegate. Its main role is returning an object responsible for the animation.

2) Creating that object. It has to implement the UIViewControllerAnimatedTransitioning protocol.

3) The method animateTransition is part of that protocol and here we’ve “drawn” the animation thanks to the transition context. The context (UIViewControllerContextTransitioning) comes with important information such as the “from”, the “to” controllers and the containerView where the animation takes place.

You can take a look at my