Skip to content

Commit

Permalink
finished rework for Motion
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Dahan committed Dec 20, 2017
1 parent 601c787 commit 20239fe
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions Sources/Transition/MotionTransition+Start.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ extension MotionTransition {
prepareContainer()
prepareContext()

for v in preprocessors {
v.motion = self
}

for v in animators {
v.motion = self
}

prepareViewHierarchy()
prepareAnimatingViews()
prepareToView()
Expand Down Expand Up @@ -100,8 +92,8 @@ fileprivate extension MotionTransition {
func prepareSnapshotView() {
fullScreenSnapshot = transitionContainer?.window?.snapshotView(afterScreenUpdates: false) ?? fromView?.snapshotView(afterScreenUpdates: false)

if let snapshot = fullScreenSnapshot {
(transitionContainer?.window ?? transitionContainer)?.addSubview(snapshot)
if let v = fullScreenSnapshot {
(transitionContainer?.window ?? transitionContainer)?.addSubview(v)
}

if let v = fromViewController?.motionStoredSnapshot {
Expand Down Expand Up @@ -143,7 +135,7 @@ fileprivate extension MotionTransition {

/// Prepares the transition container.
func prepareTransitionContainer() {
transitionContainer?.isUserInteractionEnabled = false
transitionContainer?.isUserInteractionEnabled = isUserInteractionEnabled
}

/// Prepares the view that holds all the animating views.
Expand All @@ -161,14 +153,22 @@ fileprivate extension MotionTransition {
func prepareContext() {
context = MotionContext(container: container)

guard let fv = fromView else {
return
for v in preprocessors {
v.motion = self
}

This comment has been minimized.

Copy link
@OrkhanAlikhanov

for v in animators {
v.motion = self
}

guard let tv = toView else {
return
}

guard let fv = fromView else {
return
}

context.loadViewAlpha(rootView: tv)
container.addSubview(tv)

Expand All @@ -185,12 +185,14 @@ fileprivate extension MotionTransition {

/// Prepares the view hierarchy.
func prepareViewHierarchy() {
if (.auto == viewOrderStrategy &&
!isPresenting &&
!isTabBarController) ||
if (.auto == viewOrderStrategy && !isPresenting && !isTabBarController) ||
.sourceViewOnTop == viewOrderStrategy {
context.insertToViewFirst = true
}

for v in preprocessors {
v.process(fromViews: context.fromViews, toViews: context.toViews)
}
}

/// Prepares the transition fromView & toView pairs.
Expand All @@ -204,8 +206,6 @@ fileprivate extension MotionTransition {
return false
}

print("FROM PREPARED", animatingFromViews)

animatingToViews = context.toViews.filter { (view) -> Bool in
for animator in animators {
if animator.canAnimate(view: view, isAppearing: true) {
Expand All @@ -214,8 +214,6 @@ fileprivate extension MotionTransition {
}
return false
}

print("TO PREPARED", animatingFromViews)
}

/// Prepares the to view.
Expand Down

0 comments on commit 20239fe

Please sign in to comment.