Commit 7a639921 by Daniel Dahan

minor cleanups before MotionTransition review

parent af4d74d4
...@@ -277,6 +277,7 @@ fileprivate extension MotionCoreAnimationViewContext { ...@@ -277,6 +277,7 @@ fileprivate extension MotionCoreAnimationViewContext {
} }
} else { } else {
let sizeRatio = oldSize / newSize let sizeRatio = oldSize / newSize
for v in view.subviews { for v in view.subviews {
let center = v.center let center = v.center
let size = v.bounds.size let size = v.bounds.size
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
import UIKit import UIKit
public struct MotionTargetState { 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. /// The initial state that the transition will start at.
internal var beginState: [MotionModifier]? internal var beginState: [MotionModifier]?
...@@ -106,9 +109,6 @@ public struct MotionTargetState { ...@@ -106,9 +109,6 @@ public struct MotionTargetState {
/// The arc curve value. /// The arc curve value.
public var arc: CGFloat? public var arc: CGFloat?
/// The identifier value to match source and destination views.
public var motionIdentifier: String?
/// The cascading animation settings. /// The cascading animation settings.
public var cascade: (TimeInterval, CascadeDirection, Bool)? public var cascade: (TimeInterval, CascadeDirection, Bool)?
......
...@@ -47,11 +47,11 @@ public struct MotionConditionalContext { ...@@ -47,11 +47,11 @@ public struct MotionConditionalContext {
} }
public var isMatched: Bool { public var isMatched: Bool {
return matchedView != nil return nil != matchedView
} }
public var isAncestorViewMatched: Bool { public var isAncestorViewMatched: Bool {
return matchedAncestorView != nil return nil != matchedAncestorView
} }
public var matchedView: UIView? { public var matchedView: UIView? {
...@@ -101,9 +101,9 @@ class ConditionalPreprocessor: MotionCorePreprocessor { ...@@ -101,9 +101,9 @@ class ConditionalPreprocessor: MotionCorePreprocessor {
continue continue
} }
for (condition, transitions) in conditionalModifiers { for (condition, modifiers) in conditionalModifiers {
if condition(MotionConditionalContext(motion: motion, view: v, isAppearing: isAppearing)) { 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 { ...@@ -63,20 +63,20 @@ class IgnoreSubviewTransitionsPreprocessor: MotionCorePreprocessor {
continue continue
} }
cleanSubviewTransitions(for: parentView) cleanSubviewModifiers(for: parentView)
} }
} }
} }
fileprivate extension IgnoreSubviewTransitionsPreprocessor { 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. - Parameter for view: A UIView.
*/ */
func cleanSubviewTransitions(for view: UIView) { func cleanSubviewModifiers(for view: UIView) {
for v in view.subviews { for v in view.subviews {
context[v] = nil context[v] = nil
cleanSubviewTransitions(for: v) cleanSubviewModifiers(for: v)
} }
} }
} }
...@@ -44,7 +44,7 @@ class SourcePreprocessor: MotionCorePreprocessor { ...@@ -44,7 +44,7 @@ class SourcePreprocessor: MotionCorePreprocessor {
} }
for tv in toViews { 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 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