Commit 7a639921 by Daniel Dahan

minor cleanups before MotionTransition review

parent af4d74d4
......@@ -277,6 +277,7 @@ fileprivate extension MotionCoreAnimationViewContext {
}
} else {
let sizeRatio = oldSize / newSize
for v in view.subviews {
let center = v.center
let size = v.bounds.size
......
......@@ -29,6 +29,9 @@
import UIKit
public struct MotionTargetState {
/// The identifier value to match source and destination views.
public var motionIdentifier: String?
/// The initial state that the transition will start at.
internal var beginState: [MotionModifier]?
......@@ -106,9 +109,6 @@ public struct MotionTargetState {
/// The arc curve value.
public var arc: CGFloat?
/// The identifier value to match source and destination views.
public var motionIdentifier: String?
/// The cascading animation settings.
public var cascade: (TimeInterval, CascadeDirection, Bool)?
......
......@@ -47,11 +47,11 @@ public struct MotionConditionalContext {
}
public var isMatched: Bool {
return matchedView != nil
return nil != matchedView
}
public var isAncestorViewMatched: Bool {
return matchedAncestorView != nil
return nil != matchedAncestorView
}
public var matchedView: UIView? {
......@@ -101,9 +101,9 @@ class ConditionalPreprocessor: MotionCorePreprocessor {
continue
}
for (condition, transitions) in conditionalModifiers {
for (condition, modifiers) in conditionalModifiers {
if condition(MotionConditionalContext(motion: motion, view: v, isAppearing: isAppearing)) {
context[v]!.append(contentsOf: transitions)
context[v]!.append(contentsOf: modifiers)
}
}
}
......
......@@ -63,20 +63,20 @@ class IgnoreSubviewTransitionsPreprocessor: MotionCorePreprocessor {
continue
}
cleanSubviewTransitions(for: parentView)
cleanSubviewModifiers(for: parentView)
}
}
}
fileprivate extension IgnoreSubviewTransitionsPreprocessor {
/**
Clears the transition for a given view's subviews.
Clears the modifiers for a given view's subviews.
- Parameter for view: A UIView.
*/
func cleanSubviewTransitions(for view: UIView) {
func cleanSubviewModifiers(for view: UIView) {
for v in view.subviews {
context[v] = nil
cleanSubviewTransitions(for: v)
cleanSubviewModifiers(for: v)
}
}
}
......@@ -44,7 +44,7 @@ class SourcePreprocessor: MotionCorePreprocessor {
}
for tv in toViews {
guard let i = context[tv]?.motionIdentifier, let fv = context.sourceView(for: i) else {
guard let motionIdentifier = context[tv]?.motionIdentifier, let fv = context.sourceView(for: motionIdentifier) else {
continue
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment