Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Move fallback calculations to later in the transition lifecycle.
Browse files Browse the repository at this point in the history
Summary: This ensures that fallback calculations have access to the containerView property.

Reviewers: O2 Material Motion, O4 Material Apple platform reviewers, #material_motion, markwei

Reviewed By: O2 Material Motion, O4 Material Apple platform reviewers, #material_motion, markwei

Tags: #material_motion

Differential Revision: http://codereview.cc/D3239
  • Loading branch information
Jeff Verkoeyen committed May 18, 2017
1 parent 9c40e0b commit 7ae1b04
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/transitions/TransitionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ public final class TransitionContext: NSObject {
self.transition = transition

super.init()

while let fallbackTransition = self.transition as? TransitionWithFallback {
let fallback = fallbackTransition.fallbackTansition(withContext: self)
if fallback === self.transition {
break
}
self.transition = fallback
}
}

fileprivate let initialDirection: TransitionDirection
Expand Down Expand Up @@ -182,6 +174,16 @@ extension TransitionContext {
self.runtime = MotionRuntime(containerView: containerView())
self.replicator.containerView = containerView()

// We query the fallback just before initiating the transition so that the transition context is
// primed with the content view and other transition-related information.
while let fallbackTransition = self.transition as? TransitionWithFallback {
let fallback = fallbackTransition.fallbackTansition(withContext: self)
if fallback === self.transition {
break
}
self.transition = fallback
}

pokeSystemAnimations()

var terminators = transition.willBeginTransition(withContext: self, runtime: self.runtime)
Expand Down

0 comments on commit 7ae1b04

Please sign in to comment.