Home

Awesome

AppStoreTodayInteractiveTransition (Deprecated)

NOTE: This is deprecated in favor of a better implementation here.

This is an attempt to simulate App Store's Card Interactive Transition. Note that it's not exactly the same as the App Store's animation, but close!

preview

Overview

All is done with the native API, e.g. UIViewControllerAnimatedTransitioning and friends. No external libraries. Core animation/transition is all in the CardToDetailTransitionManager class.

Presenting

The card expanding animation is mainly achieved by animating AutoLayout constraints.

The way I do this is to hide the origin cell & destination view. Create a new card view, a blur view, a container view. Then animate things on those views to match the destination view.

Checkout the code in CardToDetailTransitionManager.

I wrote some more details on StackOverflow, and Medium.

Dismissing

You can notice that there is interactivity at first, and it can be triggered in two ways: left edge pan, and drag down when you reach the top. Each uses its own gesture recognizer (with some delegate code to make it work together.) In the interactivity phase, the view controller is scaled down. Then at certain point, the animation phase, the dismissing animation is triggered without interactivity, the view controller shrinking down, back to the same card position at home page.

I don't know any official ways to support this two-step interaction (interaction, then ends with closing animation without interaction), but it can be hacked by using UIView.animateKeyFrames and dividing each phase with some relative time (e.g. 0.3). As progress (calculated with the gesture recognizer state e.g. translationInView), when it reaches 0.3 progress threshold, we call finish() on the UIPercentDrivenInteractiveTransition.

Other important details

Still can't figure them out

Future improvements