Closed jverkoey closed 8 years ago
🎊 My diff is ready for review at http://codereview.cc/D1259
From the discussion at http://codereview.cc/D1259:
Why'd we need to use associated objects?
Primarily because transitioningDelegate is a weak property. Because of this, somebody needs to hold a strong reference to the instance. There are many answers to "who should own this object?" and we've chosen one that appeared to balance convenience with expressivity.
Background
We want our transitionController to customize both the present and dismiss transitions. Using an associated object is a convenient way to ensure that our controller lives at least as long as the controller whose transitions it is customizing.
Some other ways that we'd considered building this API:
Spec: https://material-motion.gitbooks.io/material-motion-starmap/content/specifications/transition_controller.html
This controller publicly conforms to
UIViewControllerTransitioningDelegate
.Example use:
Class prototype:
When
mdm_transitionController
is accessed, an instance of MDMTransitionController should lazily be created and then assigned to the view controller'stransitioningDelegate
(if one is not already set). This will allow us to hook in to the iOS view controller transitioning APIs.