Commit 9fd0e15e by Daniel Dahan

progression update for latest internal changes in Motion

parent 3bc0ad78
...@@ -7,15 +7,24 @@ ...@@ -7,15 +7,24 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
965FE9611FDCC3AF0098BDD0 /* MotionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9601FDCC3AF0098BDD0 /* MotionState.swift */; }; 965FE9631FDCCE030098BDD0 /* MotionTransition+Complete.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9621FDCCE030098BDD0 /* MotionTransition+Complete.swift */; };
965FE9631FDCCE030098BDD0 /* Motion+Complete.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9621FDCCE030098BDD0 /* Motion+Complete.swift */; };
965FE9651FDCCE910098BDD0 /* MotionProgressRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */; }; 965FE9651FDCCE910098BDD0 /* MotionProgressRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */; };
965FE9671FDD99800098BDD0 /* Motion+Start.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9661FDD99800098BDD0 /* Motion+Start.swift */; }; 965FE9671FDD99800098BDD0 /* MotionTransition+Start.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9661FDD99800098BDD0 /* MotionTransition+Start.swift */; };
965FE9691FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */; }; 965FE9691FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */; };
965FE96B1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE96A1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift */; }; 965FE96B1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE96A1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift */; };
965FE96D1FDDA6400098BDD0 /* MotionCoreAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE96C1FDDA6400098BDD0 /* MotionCoreAnimator.swift */; }; 965FE96D1FDDA6400098BDD0 /* MotionCoreAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE96C1FDDA6400098BDD0 /* MotionCoreAnimator.swift */; };
965FE96F1FDEFA8B0098BDD0 /* Motion+Animate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE96E1FDEFA8B0098BDD0 /* Motion+Animate.swift */; }; 965FE96F1FDEFA8B0098BDD0 /* MotionTransition+Animate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE96E1FDEFA8B0098BDD0 /* MotionTransition+Animate.swift */; };
965FE9771FE0976F0098BDD0 /* ConditionalPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9761FE0976F0098BDD0 /* ConditionalPreprocessor.swift */; }; 965FE9771FE0976F0098BDD0 /* ConditionalPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9761FE0976F0098BDD0 /* ConditionalPreprocessor.swift */; };
965FE97A1FE1D83D0098BDD0 /* MotionTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965FE9791FE1D83D0098BDD0 /* MotionTransition.swift */; };
965FE9811FE304E70098BDD0 /* MotionViewOrderStrategy.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9821FE304E70098BDD0 /* MotionProgressRunner.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9831FE304E70098BDD0 /* MotionCoreAnimator.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE96C1FDDA6400098BDD0 /* MotionCoreAnimator.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9841FE304E70098BDD0 /* MotionCorePreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE96A1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9851FE304E70098BDD0 /* ConditionalPreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE9761FE0976F0098BDD0 /* ConditionalPreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9861FE304E70098BDD0 /* MotionTransition.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE9791FE1D83D0098BDD0 /* MotionTransition.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9881FE304E70098BDD0 /* MotionTransition+Start.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE9661FDD99800098BDD0 /* MotionTransition+Start.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE9891FE304E70098BDD0 /* MotionTransition+Animate.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE96E1FDEFA8B0098BDD0 /* MotionTransition+Animate.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965FE98A1FE304E70098BDD0 /* MotionTransition+Complete.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965FE9621FDCCE030098BDD0 /* MotionTransition+Complete.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409651F24F7370015A2B5 /* MotionAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4093D1F24F7370015A2B5 /* MotionAnimator.swift */; }; 96E409651F24F7370015A2B5 /* MotionAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4093D1F24F7370015A2B5 /* MotionAnimator.swift */; };
96E409661F24F7370015A2B5 /* MotionAnimatorViewContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4093E1F24F7370015A2B5 /* MotionAnimatorViewContext.swift */; }; 96E409661F24F7370015A2B5 /* MotionAnimatorViewContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4093E1F24F7370015A2B5 /* MotionAnimatorViewContext.swift */; };
96E409671F24F7370015A2B5 /* MotionCoreAnimationViewContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4093F1F24F7370015A2B5 /* MotionCoreAnimationViewContext.swift */; }; 96E409671F24F7370015A2B5 /* MotionCoreAnimationViewContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4093F1F24F7370015A2B5 /* MotionCoreAnimationViewContext.swift */; };
...@@ -31,7 +40,6 @@ ...@@ -31,7 +40,6 @@
96E409721F24F7370015A2B5 /* Motion+UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4094B1F24F7370015A2B5 /* Motion+UIViewController.swift */; }; 96E409721F24F7370015A2B5 /* Motion+UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4094B1F24F7370015A2B5 /* Motion+UIViewController.swift */; };
96E409731F24F7370015A2B5 /* MotionAnimationFillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4094C1F24F7370015A2B5 /* MotionAnimationFillMode.swift */; }; 96E409731F24F7370015A2B5 /* MotionAnimationFillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4094C1F24F7370015A2B5 /* MotionAnimationFillMode.swift */; };
96E409741F24F7370015A2B5 /* Motion.h in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094F1F24F7370015A2B5 /* Motion.h */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409741F24F7370015A2B5 /* Motion.h in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094F1F24F7370015A2B5 /* Motion.h */; settings = {ATTRIBUTES = (Public, ); }; };
96E409751F24F7370015A2B5 /* Motion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409501F24F7370015A2B5 /* Motion.swift */; };
96E409761F24F7370015A2B5 /* MotionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409511F24F7370015A2B5 /* MotionAnimation.swift */; }; 96E409761F24F7370015A2B5 /* MotionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409511F24F7370015A2B5 /* MotionAnimation.swift */; };
96E409771F24F7370015A2B5 /* MotionAnimationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409521F24F7370015A2B5 /* MotionAnimationState.swift */; }; 96E409771F24F7370015A2B5 /* MotionAnimationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409521F24F7370015A2B5 /* MotionAnimationState.swift */; };
96E409781F24F7370015A2B5 /* MotionCAAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409531F24F7370015A2B5 /* MotionCAAnimation.swift */; }; 96E409781F24F7370015A2B5 /* MotionCAAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409531F24F7370015A2B5 /* MotionCAAnimation.swift */; };
...@@ -39,9 +47,9 @@ ...@@ -39,9 +47,9 @@
96E4097B1F24F7370015A2B5 /* MotionCoordinateSpace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */; }; 96E4097B1F24F7370015A2B5 /* MotionCoordinateSpace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */; };
96E4097D1F24F7370015A2B5 /* MotionPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409581F24F7370015A2B5 /* MotionPlugin.swift */; }; 96E4097D1F24F7370015A2B5 /* MotionPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409581F24F7370015A2B5 /* MotionPlugin.swift */; };
96E4097E1F24F7370015A2B5 /* MotionSnapshotType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */; }; 96E4097E1F24F7370015A2B5 /* MotionSnapshotType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */; };
96E4097F1F24F7370015A2B5 /* MotionTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095A1F24F7370015A2B5 /* MotionTransition.swift */; }; 96E4097F1F24F7370015A2B5 /* MotionModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095A1F24F7370015A2B5 /* MotionModifier.swift */; };
96E409801F24F7370015A2B5 /* MotionTransitionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */; }; 96E409801F24F7370015A2B5 /* MotionTransitionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */; };
96E409811F24F7370015A2B5 /* MotionTransitionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095C1F24F7370015A2B5 /* MotionTransitionState.swift */; }; 96E409811F24F7370015A2B5 /* MotionTargetState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095C1F24F7370015A2B5 /* MotionTargetState.swift */; };
96E409821F24F7370015A2B5 /* CascadePreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095E1F24F7370015A2B5 /* CascadePreprocessor.swift */; }; 96E409821F24F7370015A2B5 /* CascadePreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E4095E1F24F7370015A2B5 /* CascadePreprocessor.swift */; };
96E409841F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409601F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift */; }; 96E409841F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409601F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift */; };
96E409851F24F7370015A2B5 /* MatchPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409611F24F7370015A2B5 /* MatchPreprocessor.swift */; }; 96E409851F24F7370015A2B5 /* MatchPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E409611F24F7370015A2B5 /* MatchPreprocessor.swift */; };
...@@ -62,7 +70,6 @@ ...@@ -62,7 +70,6 @@
96E409951F24F7570015A2B5 /* Motion+UIView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094A1F24F7370015A2B5 /* Motion+UIView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409951F24F7570015A2B5 /* Motion+UIView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094A1F24F7370015A2B5 /* Motion+UIView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409961F24F7570015A2B5 /* Motion+UIViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094B1F24F7370015A2B5 /* Motion+UIViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409961F24F7570015A2B5 /* Motion+UIViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094B1F24F7370015A2B5 /* Motion+UIViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409971F24F7570015A2B5 /* MotionAnimationFillMode.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094C1F24F7370015A2B5 /* MotionAnimationFillMode.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409971F24F7570015A2B5 /* MotionAnimationFillMode.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4094C1F24F7370015A2B5 /* MotionAnimationFillMode.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E4099A1F24F7570015A2B5 /* Motion.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409501F24F7370015A2B5 /* Motion.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E4099B1F24F7570015A2B5 /* MotionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409511F24F7370015A2B5 /* MotionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E4099B1F24F7570015A2B5 /* MotionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409511F24F7370015A2B5 /* MotionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E4099C1F24F7570015A2B5 /* MotionAnimationState.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409521F24F7370015A2B5 /* MotionAnimationState.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E4099C1F24F7570015A2B5 /* MotionAnimationState.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409521F24F7370015A2B5 /* MotionAnimationState.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E4099D1F24F7570015A2B5 /* MotionCAAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409531F24F7370015A2B5 /* MotionCAAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E4099D1F24F7570015A2B5 /* MotionCAAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409531F24F7370015A2B5 /* MotionCAAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -70,9 +77,9 @@ ...@@ -70,9 +77,9 @@
96E409A01F24F7570015A2B5 /* MotionCoordinateSpace.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A01F24F7570015A2B5 /* MotionCoordinateSpace.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A21F24F7570015A2B5 /* MotionPlugin.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409581F24F7370015A2B5 /* MotionPlugin.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A21F24F7570015A2B5 /* MotionPlugin.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409581F24F7370015A2B5 /* MotionPlugin.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A31F24F7570015A2B5 /* MotionSnapshotType.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A31F24F7570015A2B5 /* MotionSnapshotType.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A41F24F7570015A2B5 /* MotionTransition.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095A1F24F7370015A2B5 /* MotionTransition.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A41F24F7570015A2B5 /* MotionModifier.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095A1F24F7370015A2B5 /* MotionModifier.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A51F24F7570015A2B5 /* MotionTransitionObserver.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A51F24F7570015A2B5 /* MotionTransitionObserver.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A61F24F7570015A2B5 /* MotionTransitionState.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095C1F24F7370015A2B5 /* MotionTransitionState.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A61F24F7570015A2B5 /* MotionTargetState.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095C1F24F7370015A2B5 /* MotionTargetState.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A71F24F7570015A2B5 /* CascadePreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095E1F24F7370015A2B5 /* CascadePreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A71F24F7570015A2B5 /* CascadePreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E4095E1F24F7370015A2B5 /* CascadePreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409A91F24F7570015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409601F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409A91F24F7570015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409601F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E409AA1F24F7570015A2B5 /* MatchPreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409611F24F7370015A2B5 /* MatchPreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96E409AA1F24F7570015A2B5 /* MatchPreprocessor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E409611F24F7370015A2B5 /* MatchPreprocessor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -82,15 +89,15 @@ ...@@ -82,15 +89,15 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
965FE9601FDCC3AF0098BDD0 /* MotionState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionState.swift; sourceTree = "<group>"; }; 965FE9621FDCCE030098BDD0 /* MotionTransition+Complete.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MotionTransition+Complete.swift"; sourceTree = "<group>"; };
965FE9621FDCCE030098BDD0 /* Motion+Complete.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Motion+Complete.swift"; sourceTree = "<group>"; };
965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionProgressRunner.swift; sourceTree = "<group>"; }; 965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionProgressRunner.swift; sourceTree = "<group>"; };
965FE9661FDD99800098BDD0 /* Motion+Start.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Motion+Start.swift"; sourceTree = "<group>"; }; 965FE9661FDD99800098BDD0 /* MotionTransition+Start.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MotionTransition+Start.swift"; sourceTree = "<group>"; };
965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionViewOrderStrategy.swift; sourceTree = "<group>"; }; 965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionViewOrderStrategy.swift; sourceTree = "<group>"; };
965FE96A1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionCorePreprocessor.swift; sourceTree = "<group>"; }; 965FE96A1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionCorePreprocessor.swift; sourceTree = "<group>"; };
965FE96C1FDDA6400098BDD0 /* MotionCoreAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionCoreAnimator.swift; sourceTree = "<group>"; }; 965FE96C1FDDA6400098BDD0 /* MotionCoreAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionCoreAnimator.swift; sourceTree = "<group>"; };
965FE96E1FDEFA8B0098BDD0 /* Motion+Animate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Motion+Animate.swift"; sourceTree = "<group>"; }; 965FE96E1FDEFA8B0098BDD0 /* MotionTransition+Animate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MotionTransition+Animate.swift"; sourceTree = "<group>"; };
965FE9761FE0976F0098BDD0 /* ConditionalPreprocessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConditionalPreprocessor.swift; sourceTree = "<group>"; }; 965FE9761FE0976F0098BDD0 /* ConditionalPreprocessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConditionalPreprocessor.swift; sourceTree = "<group>"; };
965FE9791FE1D83D0098BDD0 /* MotionTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MotionTransition.swift; sourceTree = "<group>"; };
96C98DD11E424AB000B22906 /* Motion.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Motion.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 96C98DD11E424AB000B22906 /* Motion.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Motion.framework; sourceTree = BUILT_PRODUCTS_DIR; };
96E4093D1F24F7370015A2B5 /* MotionAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimator.swift; sourceTree = "<group>"; }; 96E4093D1F24F7370015A2B5 /* MotionAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimator.swift; sourceTree = "<group>"; };
96E4093E1F24F7370015A2B5 /* MotionAnimatorViewContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimatorViewContext.swift; sourceTree = "<group>"; }; 96E4093E1F24F7370015A2B5 /* MotionAnimatorViewContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimatorViewContext.swift; sourceTree = "<group>"; };
...@@ -107,7 +114,6 @@ ...@@ -107,7 +114,6 @@
96E4094B1F24F7370015A2B5 /* Motion+UIViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Motion+UIViewController.swift"; sourceTree = "<group>"; }; 96E4094B1F24F7370015A2B5 /* Motion+UIViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Motion+UIViewController.swift"; sourceTree = "<group>"; };
96E4094C1F24F7370015A2B5 /* MotionAnimationFillMode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimationFillMode.swift; sourceTree = "<group>"; }; 96E4094C1F24F7370015A2B5 /* MotionAnimationFillMode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimationFillMode.swift; sourceTree = "<group>"; };
96E4094F1F24F7370015A2B5 /* Motion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Motion.h; sourceTree = "<group>"; }; 96E4094F1F24F7370015A2B5 /* Motion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Motion.h; sourceTree = "<group>"; };
96E409501F24F7370015A2B5 /* Motion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Motion.swift; sourceTree = "<group>"; };
96E409511F24F7370015A2B5 /* MotionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimation.swift; sourceTree = "<group>"; }; 96E409511F24F7370015A2B5 /* MotionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimation.swift; sourceTree = "<group>"; };
96E409521F24F7370015A2B5 /* MotionAnimationState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimationState.swift; sourceTree = "<group>"; }; 96E409521F24F7370015A2B5 /* MotionAnimationState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionAnimationState.swift; sourceTree = "<group>"; };
96E409531F24F7370015A2B5 /* MotionCAAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionCAAnimation.swift; sourceTree = "<group>"; }; 96E409531F24F7370015A2B5 /* MotionCAAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionCAAnimation.swift; sourceTree = "<group>"; };
...@@ -115,9 +121,9 @@ ...@@ -115,9 +121,9 @@
96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionCoordinateSpace.swift; sourceTree = "<group>"; }; 96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionCoordinateSpace.swift; sourceTree = "<group>"; };
96E409581F24F7370015A2B5 /* MotionPlugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionPlugin.swift; sourceTree = "<group>"; }; 96E409581F24F7370015A2B5 /* MotionPlugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionPlugin.swift; sourceTree = "<group>"; };
96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionSnapshotType.swift; sourceTree = "<group>"; }; 96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionSnapshotType.swift; sourceTree = "<group>"; };
96E4095A1F24F7370015A2B5 /* MotionTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionTransition.swift; sourceTree = "<group>"; }; 96E4095A1F24F7370015A2B5 /* MotionModifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionModifier.swift; sourceTree = "<group>"; };
96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionTransitionObserver.swift; sourceTree = "<group>"; }; 96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionTransitionObserver.swift; sourceTree = "<group>"; };
96E4095C1F24F7370015A2B5 /* MotionTransitionState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionTransitionState.swift; sourceTree = "<group>"; }; 96E4095C1F24F7370015A2B5 /* MotionTargetState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionTargetState.swift; sourceTree = "<group>"; };
96E4095E1F24F7370015A2B5 /* CascadePreprocessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CascadePreprocessor.swift; sourceTree = "<group>"; }; 96E4095E1F24F7370015A2B5 /* CascadePreprocessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CascadePreprocessor.swift; sourceTree = "<group>"; };
96E409601F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IgnoreSubviewModifiersPreprocessor.swift; sourceTree = "<group>"; }; 96E409601F24F7370015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IgnoreSubviewModifiersPreprocessor.swift; sourceTree = "<group>"; };
96E409611F24F7370015A2B5 /* MatchPreprocessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchPreprocessor.swift; sourceTree = "<group>"; }; 96E409611F24F7370015A2B5 /* MatchPreprocessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchPreprocessor.swift; sourceTree = "<group>"; };
...@@ -129,6 +135,17 @@ ...@@ -129,6 +135,17 @@
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
965FE9781FE1D8120098BDD0 /* Transition */ = {
isa = PBXGroup;
children = (
965FE9791FE1D83D0098BDD0 /* MotionTransition.swift */,
965FE9661FDD99800098BDD0 /* MotionTransition+Start.swift */,
965FE96E1FDEFA8B0098BDD0 /* MotionTransition+Animate.swift */,
965FE9621FDCCE030098BDD0 /* MotionTransition+Complete.swift */,
);
path = Transition;
sourceTree = "<group>";
};
96C98DC71E424AB000B22906 = { 96C98DC71E424AB000B22906 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -151,12 +168,7 @@ ...@@ -151,12 +168,7 @@
96E409BB1F24FC210015A2B5 /* Info.plist */, 96E409BB1F24FC210015A2B5 /* Info.plist */,
96E409BC1F24FC300015A2B5 /* LICENSE */, 96E409BC1F24FC300015A2B5 /* LICENSE */,
96E4094F1F24F7370015A2B5 /* Motion.h */, 96E4094F1F24F7370015A2B5 /* Motion.h */,
96E409501F24F7370015A2B5 /* Motion.swift */,
965FE9601FDCC3AF0098BDD0 /* MotionState.swift */,
965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */, 965FE9681FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift */,
965FE9661FDD99800098BDD0 /* Motion+Start.swift */,
965FE96E1FDEFA8B0098BDD0 /* Motion+Animate.swift */,
965FE9621FDCCE030098BDD0 /* Motion+Complete.swift */,
965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */, 965FE9641FDCCE910098BDD0 /* MotionProgressRunner.swift */,
96E409511F24F7370015A2B5 /* MotionAnimation.swift */, 96E409511F24F7370015A2B5 /* MotionAnimation.swift */,
96E409521F24F7370015A2B5 /* MotionAnimationState.swift */, 96E409521F24F7370015A2B5 /* MotionAnimationState.swift */,
...@@ -165,12 +177,13 @@ ...@@ -165,12 +177,13 @@
96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */, 96E409561F24F7370015A2B5 /* MotionCoordinateSpace.swift */,
96E409581F24F7370015A2B5 /* MotionPlugin.swift */, 96E409581F24F7370015A2B5 /* MotionPlugin.swift */,
96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */, 96E409591F24F7370015A2B5 /* MotionSnapshotType.swift */,
96E4095A1F24F7370015A2B5 /* MotionTransition.swift */, 96E4095A1F24F7370015A2B5 /* MotionModifier.swift */,
96E4095C1F24F7370015A2B5 /* MotionTargetState.swift */,
96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */, 96E4095B1F24F7370015A2B5 /* MotionTransitionObserver.swift */,
96E4095C1F24F7370015A2B5 /* MotionTransitionState.swift */,
96E4093C1F24F7370015A2B5 /* Animator */, 96E4093C1F24F7370015A2B5 /* Animator */,
96E409431F24F7370015A2B5 /* Extensions */, 96E409431F24F7370015A2B5 /* Extensions */,
96E4095D1F24F7370015A2B5 /* Preprocessors */, 96E4095D1F24F7370015A2B5 /* Preprocessors */,
965FE9781FE1D8120098BDD0 /* Transition */,
); );
path = Sources; path = Sources;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -240,7 +253,6 @@ ...@@ -240,7 +253,6 @@
96E409951F24F7570015A2B5 /* Motion+UIView.swift in Headers */, 96E409951F24F7570015A2B5 /* Motion+UIView.swift in Headers */,
96E409961F24F7570015A2B5 /* Motion+UIViewController.swift in Headers */, 96E409961F24F7570015A2B5 /* Motion+UIViewController.swift in Headers */,
96E409971F24F7570015A2B5 /* MotionAnimationFillMode.swift in Headers */, 96E409971F24F7570015A2B5 /* MotionAnimationFillMode.swift in Headers */,
96E4099A1F24F7570015A2B5 /* Motion.swift in Headers */,
96E4099B1F24F7570015A2B5 /* MotionAnimation.swift in Headers */, 96E4099B1F24F7570015A2B5 /* MotionAnimation.swift in Headers */,
96E4099C1F24F7570015A2B5 /* MotionAnimationState.swift in Headers */, 96E4099C1F24F7570015A2B5 /* MotionAnimationState.swift in Headers */,
96E4099D1F24F7570015A2B5 /* MotionCAAnimation.swift in Headers */, 96E4099D1F24F7570015A2B5 /* MotionCAAnimation.swift in Headers */,
...@@ -248,9 +260,9 @@ ...@@ -248,9 +260,9 @@
96E409A01F24F7570015A2B5 /* MotionCoordinateSpace.swift in Headers */, 96E409A01F24F7570015A2B5 /* MotionCoordinateSpace.swift in Headers */,
96E409A21F24F7570015A2B5 /* MotionPlugin.swift in Headers */, 96E409A21F24F7570015A2B5 /* MotionPlugin.swift in Headers */,
96E409A31F24F7570015A2B5 /* MotionSnapshotType.swift in Headers */, 96E409A31F24F7570015A2B5 /* MotionSnapshotType.swift in Headers */,
96E409A41F24F7570015A2B5 /* MotionTransition.swift in Headers */, 96E409A41F24F7570015A2B5 /* MotionModifier.swift in Headers */,
96E409A51F24F7570015A2B5 /* MotionTransitionObserver.swift in Headers */, 96E409A51F24F7570015A2B5 /* MotionTransitionObserver.swift in Headers */,
96E409A61F24F7570015A2B5 /* MotionTransitionState.swift in Headers */, 96E409A61F24F7570015A2B5 /* MotionTargetState.swift in Headers */,
96E409A71F24F7570015A2B5 /* CascadePreprocessor.swift in Headers */, 96E409A71F24F7570015A2B5 /* CascadePreprocessor.swift in Headers */,
96E409A91F24F7570015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift in Headers */, 96E409A91F24F7570015A2B5 /* IgnoreSubviewModifiersPreprocessor.swift in Headers */,
96E409AA1F24F7570015A2B5 /* MatchPreprocessor.swift in Headers */, 96E409AA1F24F7570015A2B5 /* MatchPreprocessor.swift in Headers */,
...@@ -258,6 +270,15 @@ ...@@ -258,6 +270,15 @@
96E409AC1F24F7570015A2B5 /* SourcePreprocessor.swift in Headers */, 96E409AC1F24F7570015A2B5 /* SourcePreprocessor.swift in Headers */,
96E409AD1F24F7570015A2B5 /* TransitionPreprocessor.swift in Headers */, 96E409AD1F24F7570015A2B5 /* TransitionPreprocessor.swift in Headers */,
96E409741F24F7370015A2B5 /* Motion.h in Headers */, 96E409741F24F7370015A2B5 /* Motion.h in Headers */,
965FE9811FE304E70098BDD0 /* MotionViewOrderStrategy.swift in Headers */,
965FE9821FE304E70098BDD0 /* MotionProgressRunner.swift in Headers */,
965FE9831FE304E70098BDD0 /* MotionCoreAnimator.swift in Headers */,
965FE9841FE304E70098BDD0 /* MotionCorePreprocessor.swift in Headers */,
965FE9851FE304E70098BDD0 /* ConditionalPreprocessor.swift in Headers */,
965FE9861FE304E70098BDD0 /* MotionTransition.swift in Headers */,
965FE9881FE304E70098BDD0 /* MotionTransition+Start.swift in Headers */,
965FE9891FE304E70098BDD0 /* MotionTransition+Animate.swift in Headers */,
965FE98A1FE304E70098BDD0 /* MotionTransition+Complete.swift in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -321,7 +342,7 @@ ...@@ -321,7 +342,7 @@
96E409731F24F7370015A2B5 /* MotionAnimationFillMode.swift in Sources */, 96E409731F24F7370015A2B5 /* MotionAnimationFillMode.swift in Sources */,
96E409791F24F7370015A2B5 /* MotionContext.swift in Sources */, 96E409791F24F7370015A2B5 /* MotionContext.swift in Sources */,
965FE96B1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift in Sources */, 965FE96B1FDDA4EA0098BDD0 /* MotionCorePreprocessor.swift in Sources */,
965FE9631FDCCE030098BDD0 /* Motion+Complete.swift in Sources */, 965FE9631FDCCE030098BDD0 /* MotionTransition+Complete.swift in Sources */,
96E4097D1F24F7370015A2B5 /* MotionPlugin.swift in Sources */, 96E4097D1F24F7370015A2B5 /* MotionPlugin.swift in Sources */,
965FE96D1FDDA6400098BDD0 /* MotionCoreAnimator.swift in Sources */, 965FE96D1FDDA6400098BDD0 /* MotionCoreAnimator.swift in Sources */,
96E4096E1F24F7370015A2B5 /* Motion+CG.swift in Sources */, 96E4096E1F24F7370015A2B5 /* Motion+CG.swift in Sources */,
...@@ -330,7 +351,7 @@ ...@@ -330,7 +351,7 @@
96E409821F24F7370015A2B5 /* CascadePreprocessor.swift in Sources */, 96E409821F24F7370015A2B5 /* CascadePreprocessor.swift in Sources */,
96E4096C1F24F7370015A2B5 /* Motion+CALayer.swift in Sources */, 96E4096C1F24F7370015A2B5 /* Motion+CALayer.swift in Sources */,
96E409781F24F7370015A2B5 /* MotionCAAnimation.swift in Sources */, 96E409781F24F7370015A2B5 /* MotionCAAnimation.swift in Sources */,
96E409811F24F7370015A2B5 /* MotionTransitionState.swift in Sources */, 96E409811F24F7370015A2B5 /* MotionTargetState.swift in Sources */,
96E409801F24F7370015A2B5 /* MotionTransitionObserver.swift in Sources */, 96E409801F24F7370015A2B5 /* MotionTransitionObserver.swift in Sources */,
96E409691F24F7370015A2B5 /* MotionTransitionAnimator.swift in Sources */, 96E409691F24F7370015A2B5 /* MotionTransitionAnimator.swift in Sources */,
96E409651F24F7370015A2B5 /* MotionAnimator.swift in Sources */, 96E409651F24F7370015A2B5 /* MotionAnimator.swift in Sources */,
...@@ -343,19 +364,18 @@ ...@@ -343,19 +364,18 @@
96E409721F24F7370015A2B5 /* Motion+UIViewController.swift in Sources */, 96E409721F24F7370015A2B5 /* Motion+UIViewController.swift in Sources */,
96E4097E1F24F7370015A2B5 /* MotionSnapshotType.swift in Sources */, 96E4097E1F24F7370015A2B5 /* MotionSnapshotType.swift in Sources */,
965FE9691FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift in Sources */, 965FE9691FDDA1F20098BDD0 /* MotionViewOrderStrategy.swift in Sources */,
965FE97A1FE1D83D0098BDD0 /* MotionTransition.swift in Sources */,
96E409871F24F7370015A2B5 /* SourcePreprocessor.swift in Sources */, 96E409871F24F7370015A2B5 /* SourcePreprocessor.swift in Sources */,
96E409701F24F7370015A2B5 /* Motion+UIKit.swift in Sources */, 96E409701F24F7370015A2B5 /* Motion+UIKit.swift in Sources */,
965FE9771FE0976F0098BDD0 /* ConditionalPreprocessor.swift in Sources */, 965FE9771FE0976F0098BDD0 /* ConditionalPreprocessor.swift in Sources */,
96E4097B1F24F7370015A2B5 /* MotionCoordinateSpace.swift in Sources */, 96E4097B1F24F7370015A2B5 /* MotionCoordinateSpace.swift in Sources */,
96E409881F24F7370015A2B5 /* TransitionPreprocessor.swift in Sources */, 96E409881F24F7370015A2B5 /* TransitionPreprocessor.swift in Sources */,
965FE9671FDD99800098BDD0 /* Motion+Start.swift in Sources */, 965FE9671FDD99800098BDD0 /* MotionTransition+Start.swift in Sources */,
96E4096A1F24F7370015A2B5 /* MotionViewPropertyViewContext.swift in Sources */, 96E4096A1F24F7370015A2B5 /* MotionViewPropertyViewContext.swift in Sources */,
96E409661F24F7370015A2B5 /* MotionAnimatorViewContext.swift in Sources */, 96E409661F24F7370015A2B5 /* MotionAnimatorViewContext.swift in Sources */,
965FE9651FDCCE910098BDD0 /* MotionProgressRunner.swift in Sources */, 965FE9651FDCCE910098BDD0 /* MotionProgressRunner.swift in Sources */,
965FE9611FDCC3AF0098BDD0 /* MotionState.swift in Sources */, 96E4097F1F24F7370015A2B5 /* MotionModifier.swift in Sources */,
96E4097F1F24F7370015A2B5 /* MotionTransition.swift in Sources */, 965FE96F1FDEFA8B0098BDD0 /* MotionTransition+Animate.swift in Sources */,
965FE96F1FDEFA8B0098BDD0 /* Motion+Animate.swift in Sources */,
96E409751F24F7370015A2B5 /* Motion.swift in Sources */,
96E4096F1F24F7370015A2B5 /* Motion+Obj-C.swift in Sources */, 96E4096F1F24F7370015A2B5 /* Motion+Obj-C.swift in Sources */,
96E409711F24F7370015A2B5 /* Motion+UIView.swift in Sources */, 96E409711F24F7370015A2B5 /* Motion+UIView.swift in Sources */,
); );
......
...@@ -30,7 +30,7 @@ import UIKit ...@@ -30,7 +30,7 @@ import UIKit
public protocol MotionAnimator: class { public protocol MotionAnimator: class {
/// A reference to Motion. /// A reference to Motion.
weak var motion: Motion! { get set } weak var motion: MotionTransition! { get set }
/// Cleans the contexts. /// Cleans the contexts.
func clean() func clean()
...@@ -68,8 +68,8 @@ public protocol MotionAnimator: class { ...@@ -68,8 +68,8 @@ public protocol MotionAnimator: class {
/** /**
Applies the given state to the given view. Applies the given state to the given view.
- Parameter state: A MotionTransitionState. - Parameter state: A MotionModifier.
- Parameter to view: A UIView. - Parameter to view: A UIView.
*/ */
func apply(state: MotionTransitionState, to view: UIView) func apply(state: MotionTargetState, to view: UIView)
} }
...@@ -36,7 +36,7 @@ internal class MotionAnimatorViewContext { ...@@ -36,7 +36,7 @@ internal class MotionAnimatorViewContext {
var snapshot: UIView var snapshot: UIView
/// The animation target state. /// The animation target state.
var targetState: MotionTransitionState var targetState: MotionTargetState
/// A boolean indicating if the view is appearing. /// A boolean indicating if the view is appearing.
var isAppearing: Bool var isAppearing: Bool
...@@ -58,10 +58,10 @@ internal class MotionAnimatorViewContext { ...@@ -58,10 +58,10 @@ internal class MotionAnimatorViewContext {
An initializer. An initializer.
- Parameter animator: A MotionAnimator. - Parameter animator: A MotionAnimator.
- Parameter snapshot: A UIView. - Parameter snapshot: A UIView.
- Parameter targetState: A MotionTransitionState. - Parameter targetState: A MotionModifier.
- Parameter isAppearing: A Boolean. - Parameter isAppearing: A Boolean.
*/ */
required init(animator: MotionCoreAnimator, snapshot: UIView, targetState: MotionTransitionState, isAppearing: Bool) { required init(animator: MotionCoreAnimator, snapshot: UIView, targetState: MotionTargetState, isAppearing: Bool) {
self.animator = animator self.animator = animator
self.snapshot = snapshot self.snapshot = snapshot
self.targetState = targetState self.targetState = targetState
...@@ -77,11 +77,11 @@ internal class MotionAnimatorViewContext { ...@@ -77,11 +77,11 @@ internal class MotionAnimatorViewContext {
A class function that determines if a view can be animated A class function that determines if a view can be animated
to a given state. to a given state.
- Parameter view: A UIView. - Parameter view: A UIView.
- Parameter state: A MotionTransitionState. - Parameter state: A MotionModifier.
- Parameter isAppearing: A boolean that determines whether the - Parameter isAppearing: A boolean that determines whether the
view is appearing. view is appearing.
*/ */
class func canAnimate(view: UIView, state: MotionTransitionState, isAppearing: Bool) -> Bool { class func canAnimate(view: UIView, state: MotionTargetState, isAppearing: Bool) -> Bool {
return false return false
} }
...@@ -106,9 +106,9 @@ internal class MotionAnimatorViewContext { ...@@ -106,9 +106,9 @@ internal class MotionAnimatorViewContext {
/** /**
Applies the given state to the target state. Applies the given state to the target state.
- Parameter state: A MotionTransitionState. - Parameter state: A MotionModifier.
*/ */
func apply(state: MotionTransitionState) {} func apply(state: MotionTargetState) {}
/** /**
Starts the animations with an appearing boolean flag. Starts the animations with an appearing boolean flag.
......
...@@ -30,7 +30,7 @@ import UIKit ...@@ -30,7 +30,7 @@ import UIKit
internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext { internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext {
/// The transition states. /// The transition states.
fileprivate var transitionStates = [String: (Any?, Any?)]() fileprivate var state = [String: (Any?, Any?)]()
/// A reference to the animation timing function. /// A reference to the animation timing function.
fileprivate var timingFunction = CAMediaTimingFunction.standard fileprivate var timingFunction = CAMediaTimingFunction.standard
...@@ -51,7 +51,7 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext { ...@@ -51,7 +51,7 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext {
overlayLayer = nil overlayLayer = nil
} }
override class func canAnimate(view: UIView, state: MotionTransitionState, isAppearing: Bool) -> Bool { override class func canAnimate(view: UIView, state: MotionTargetState, isAppearing: Bool) -> Bool {
return nil != state.position || return nil != state.position ||
nil != state.size || nil != state.size ||
nil != state.transform || nil != state.transform ||
...@@ -70,13 +70,13 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext { ...@@ -70,13 +70,13 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext {
state.forceAnimate state.forceAnimate
} }
override func apply(state: MotionTransitionState) { override func apply(state: MotionTargetState) {
let targetState = viewState(targetState: state) let targetState = viewState(targetState: state)
for (key, targetValue) in targetState { for (key, targetValue) in targetState {
if nil == transitionStates[key] { if nil == state[key] {
let current = currentValue(for: key) let current = currentValue(for: key)
transitionStates[key] = (current, current) state[key] = (current, current)
} }
let oldAnimations = animations let oldAnimations = animations
...@@ -87,8 +87,8 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext { ...@@ -87,8 +87,8 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext {
} }
override func resume(at elapsedTime: TimeInterval, isReversed: Bool) -> TimeInterval { override func resume(at elapsedTime: TimeInterval, isReversed: Bool) -> TimeInterval {
for (key, (fromValue, toValue)) in transitionStates { for (key, (fromValue, toValue)) in state {
transitionStates[key] = (currentValue(for: key), isReversed ? fromValue : toValue) state[key] = (currentValue(for: key), isReversed ? fromValue : toValue)
} }
if isReversed { if isReversed {
...@@ -125,26 +125,29 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext { ...@@ -125,26 +125,29 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext {
} }
override func startAnimations() -> TimeInterval { override func startAnimations() -> TimeInterval {
if let beginState = targetState.beginState?.state { if let beginStateModifiers = targetState.beginState {
let beginState = MotionTargetState(modifiers: beginStateModifiers)
let appeared = viewState(targetState: beginState) let appeared = viewState(targetState: beginState)
for (k, v) in appeared { for (k, v) in appeared {
snapshot.layer.setValue(v, forKeyPath: k) snapshot.layer.setValue(v, forKeyPath: k)
} }
if let (k, v) = beginState.overlay { if let (color, opacity) = beginState.overlay {
let overlay = getOverlayLayer() let overlay = getOverlayLayer()
overlay.backgroundColor = k overlay.backgroundColor = color
overlay.opacity = Float(v) overlay.opacity = Float(opacity)
} }
} }
let disappeared = viewState(targetState: targetState) let disappeared = viewState(targetState: targetState)
for (k, v) in disappeared {
let isAppearingState = currentValue(for: k)
let toValue = isAppearing ? isAppearingState : v
let fromValue = !isAppearing ? isAppearingState : v
transitionStates[k] = (fromValue, toValue) for (k, disappearedState) in disappeared {
let appearingState = currentValue(for: k)
let toValue = isAppearing ? appearingState : disappearedState
let fromValue = !isAppearing ? appearingState : disappearedState
state[k] = (fromValue, toValue)
} }
return animate(delay: targetState.delay, duration: duration) return animate(delay: targetState.delay, duration: duration)
...@@ -416,7 +419,7 @@ fileprivate extension MotionCoreAnimationViewContext { ...@@ -416,7 +419,7 @@ fileprivate extension MotionCoreAnimationViewContext {
animations = [] animations = []
for (key, (fromValue, toValue)) in transitionStates { for (key, (fromValue, toValue)) in state {
let neededTime = animate(key: key, beginTime: currentTime + delay, duration: duration, fromValue: fromValue, toValue: toValue) let neededTime = animate(key: key, beginTime: currentTime + delay, duration: duration, fromValue: fromValue, toValue: toValue)
timeUntilStop = max(timeUntilStop, neededTime) timeUntilStop = max(timeUntilStop, neededTime)
} }
...@@ -426,10 +429,10 @@ fileprivate extension MotionCoreAnimationViewContext { ...@@ -426,10 +429,10 @@ fileprivate extension MotionCoreAnimationViewContext {
/** /**
Constructs a map of key paths to animation state values. Constructs a map of key paths to animation state values.
- Parameter targetState state: A MotionTransitionState. - Parameter targetState state: A MotionModifier.
- Returns: A map of key paths to animation values. - Returns: A map of key paths to animation values.
*/ */
func viewState(targetState ts: MotionTransitionState) -> [String: Any?] { func viewState(targetState ts: MotionTargetState) -> [String: Any?] {
var ts = ts var ts = ts
var values = [String: Any?]() var values = [String: Any?]()
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
import UIKit import UIKit
class MotionCoreAnimator: MotionAnimator { class MotionCoreAnimator: MotionAnimator {
weak public var motion: Motion! weak public var motion: MotionTransition!
/// A reference to the MotionContext. /// A reference to the MotionContext.
public var context: MotionContext! { public var context: MotionContext! {
...@@ -52,7 +52,7 @@ class MotionCoreAnimator: MotionAnimator { ...@@ -52,7 +52,7 @@ class MotionCoreAnimator: MotionAnimator {
return 0 return 0
} }
func apply(state: MotionTransitionState, to view: UIView) {} func apply(state: MotionTargetState, to view: UIView) {}
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import UIKit import UIKit
internal class MotionTransitionAnimator<T: MotionAnimatorViewContext>: MotionCoreAnimator { internal class MotionTargetStateAnimator<T: MotionAnimatorViewContext>: MotionCoreAnimator {
/// An index of views to their corresponding animator context. /// An index of views to their corresponding animator context.
var viewToContexts = [UIView: T]() var viewToContexts = [UIView: T]()
...@@ -132,10 +132,10 @@ internal class MotionTransitionAnimator<T: MotionAnimatorViewContext>: MotionCor ...@@ -132,10 +132,10 @@ internal class MotionTransitionAnimator<T: MotionAnimatorViewContext>: MotionCor
/** /**
Applies the given state to the given view. Applies the given state to the given view.
- Parameter state: A MotionTransitionState. - Parameter state: A MotionModifier.
- Parameter to view: A UIView. - Parameter to view: A UIView.
*/ */
override func apply(state: MotionTransitionState, to view: UIView) { override func apply(state: MotionTargetState, to view: UIView) {
guard let v = viewToContexts[view] else { guard let v = viewToContexts[view] else {
return return
} }
...@@ -144,7 +144,7 @@ internal class MotionTransitionAnimator<T: MotionAnimatorViewContext>: MotionCor ...@@ -144,7 +144,7 @@ internal class MotionTransitionAnimator<T: MotionAnimatorViewContext>: MotionCor
} }
} }
fileprivate extension MotionTransitionAnimator { fileprivate extension MotionTargetStateAnimator {
/** /**
Creates a view context for a given view. Creates a view context for a given view.
- Parameter view: A UIView. - Parameter view: A UIView.
......
...@@ -39,7 +39,7 @@ internal class MotionViewPropertyViewContext: MotionAnimatorViewContext { ...@@ -39,7 +39,7 @@ internal class MotionViewPropertyViewContext: MotionAnimatorViewContext {
/// Starting effect. /// Starting effect.
fileprivate var startEffect: UIVisualEffect? fileprivate var startEffect: UIVisualEffect?
override class func canAnimate(view: UIView, state: MotionTransitionState, isAppearing: Bool) -> Bool { override class func canAnimate(view: UIView, state: MotionTargetState, isAppearing: Bool) -> Bool {
return view is UIVisualEffectView && nil != state.opacity return view is UIVisualEffectView && nil != state.opacity
} }
......
...@@ -43,8 +43,8 @@ fileprivate struct AssociatedInstance { ...@@ -43,8 +43,8 @@ fileprivate struct AssociatedInstance {
/// An optional reference to the motion animations. /// An optional reference to the motion animations.
fileprivate var animations: [MotionAnimation]? fileprivate var animations: [MotionAnimation]?
/// An optional reference to the motion transition animations. /// An optional reference to the motion animation modifiers.
fileprivate var transitions: [MotionTransition]? fileprivate var modifiers: [MotionModifier]?
/// An alpha value. /// An alpha value.
fileprivate var alpha: CGFloat? fileprivate var alpha: CGFloat?
...@@ -55,7 +55,7 @@ fileprivate extension UIView { ...@@ -55,7 +55,7 @@ fileprivate extension UIView {
fileprivate var associatedInstance: AssociatedInstance { fileprivate var associatedInstance: AssociatedInstance {
get { get {
return AssociatedObject.get(base: self, key: &AssociatedInstanceKey) { return AssociatedObject.get(base: self, key: &AssociatedInstanceKey) {
return AssociatedInstance(isEnabled: true, isEnabledForSubviews: true, identifier: nil, animations: nil, transitions: nil, alpha: 1) return AssociatedInstance(isEnabled: true, isEnabledForSubviews: true, identifier: nil, animations: nil, modifiers: nil, alpha: 1)
} }
} }
set(value) { set(value) {
...@@ -136,30 +136,30 @@ public extension UIView { ...@@ -136,30 +136,30 @@ public extension UIView {
} }
/** /**
A function that accepts a list of MotionTransition values. A function that accepts a list of MotionTargetState values.
- Parameter transitions: A list of MotionTransition values. - Parameter transitions: A list of MotionTargetState values.
*/ */
func transition(_ transitions: MotionTransition...) { func transition(_ modifiers: MotionModifier...) {
transition(transitions) transition(modifiers)
} }
/** /**
A function that accepts an Array of MotionTransition values. A function that accepts an Array of MotionTargetState values.
- Parameter transitions: An Array of MotionTransition values. - Parameter transitions: An Array of MotionTargetState values.
*/ */
func transition(_ transitions: [MotionTransition]) { func transition(_ modifiers: [MotionModifier]) {
motionTransitions = transitions motionModifiers = modifiers
} }
} }
internal extension UIView { internal extension UIView {
/// The animations to run while in transition. /// The animations to run while in transition.
var motionTransitions: [MotionTransition]? { var motionModifiers: [MotionModifier]? {
get { get {
return associatedInstance.transitions return associatedInstance.modifiers
} }
set(value) { set(value) {
associatedInstance.transitions = value associatedInstance.modifiers = value
} }
} }
...@@ -286,10 +286,10 @@ internal extension UIView { ...@@ -286,10 +286,10 @@ internal extension UIView {
/** /**
Calculates the optimized duration for a view. Calculates the optimized duration for a view.
- Parameter targetState: A MotionTransitionState. - Parameter targetState: A MotionTargetState.
- Returns: A TimeInterval. - Returns: A TimeInterval.
*/ */
func optimizedDuration(targetState: MotionTransitionState) -> TimeInterval { func optimizedDuration(targetState: MotionTargetState) -> TimeInterval {
return optimizedDuration(position: targetState.position, return optimizedDuration(position: targetState.position,
size: targetState.size, size: targetState.size,
transform: targetState.transform) transform: targetState.transform)
......
...@@ -32,13 +32,13 @@ fileprivate var AssociatedInstanceKey: UInt8 = 0 ...@@ -32,13 +32,13 @@ fileprivate var AssociatedInstanceKey: UInt8 = 0
fileprivate struct AssociatedInstance { fileprivate struct AssociatedInstance {
/// A reference to the modal animation. /// A reference to the modal animation.
var modalTransitionType: MotionTransitionType var modalTransitionType: MotionTransitionAnimationType
/// A reference to the navigation animation. /// A reference to the navigation animation.
var navigationTransitionType: MotionTransitionType var navigationTransitionType: MotionTransitionAnimationType
/// A reference to the tabBar animation. /// A reference to the tabBar animation.
var tabBarTransitionType: MotionTransitionType var tabBarTransitionType: MotionTransitionAnimationType
/// A reference to the stored snapshot. /// A reference to the stored snapshot.
var storedSnapshot: UIView? var storedSnapshot: UIView?
...@@ -75,7 +75,7 @@ extension UIViewController { ...@@ -75,7 +75,7 @@ extension UIViewController {
} }
/// Default motion animation type for presenting & dismissing modally. /// Default motion animation type for presenting & dismissing modally.
public var motionTransitionType: MotionTransitionType { public var motionTransitionType: MotionTransitionAnimationType {
get { get {
return associatedInstance.modalTransitionType return associatedInstance.modalTransitionType
} }
...@@ -161,7 +161,7 @@ extension UIViewController { ...@@ -161,7 +161,7 @@ extension UIViewController {
extension UINavigationController { extension UINavigationController {
/// Default motion animation type for push and pop within the navigation controller. /// Default motion animation type for push and pop within the navigation controller.
public var motionNavigationTransitionType: MotionTransitionType { public var motionNavigationTransitionType: MotionTransitionAnimationType {
get { get {
return associatedInstance.navigationTransitionType return associatedInstance.navigationTransitionType
} }
...@@ -173,7 +173,7 @@ extension UINavigationController { ...@@ -173,7 +173,7 @@ extension UINavigationController {
extension UITabBarController { extension UITabBarController {
/// Default motion animation type for switching tabs within the tab bar controller. /// Default motion animation type for switching tabs within the tab bar controller.
public var motionTabBarTransitionType: MotionTransitionType { public var motionTabBarTransitionType: MotionTransitionAnimationType {
get { get {
return associatedInstance.tabBarTransitionType return associatedInstance.tabBarTransitionType
} }
......
...@@ -45,7 +45,7 @@ public class MotionContext { ...@@ -45,7 +45,7 @@ public class MotionContext {
internal var viewToAlphas = [UIView: CGFloat]() internal var viewToAlphas = [UIView: CGFloat]()
/// A reference of view to transition target state. /// A reference of view to transition target state.
internal var viewToTargetState = [UIView: MotionTransitionState]() internal var viewToTargetState = [UIView: MotionTargetState]()
/// A reference of the superview to the subviews snapshots. /// A reference of the superview to the subviews snapshots.
internal var superviewToNoSnapshotSubviewMap = [UIView: [(Int, UIView)]]() internal var superviewToNoSnapshotSubviewMap = [UIView: [(Int, UIView)]]()
...@@ -94,14 +94,21 @@ internal extension MotionContext { ...@@ -94,14 +94,21 @@ internal extension MotionContext {
for v in views { for v in views {
v.layer.removeAllAnimations() v.layer.removeAllAnimations()
if container.convert(v.bounds, from: v).intersects(container.bounds) { let targetState: MotionTargetState?
if let i = v.motionIdentifier {
identifierMap[i] = v if let modifiers = v.motionModifiers {
targetState = MotionTargetState(modifiers: modifiers)
} else {
targetState = nil
} }
if let i = v.motionTransitions { if true == targetState?.forceAnimate || container.convert(v.bounds, from: v).intersects(container.bounds) {
viewToTargetState[v] = MotionTransitionState(transitions: i) if let motionIdentifier = v.motionIdentifier {
identifierMap[motionIdentifier] = v
} }
viewToTargetState[v] = targetState
} }
} }
} }
...@@ -110,11 +117,11 @@ internal extension MotionContext { ...@@ -110,11 +117,11 @@ internal extension MotionContext {
public extension MotionContext { public extension MotionContext {
/** /**
A subscript that takes a given view and retrieves a A subscript that takes a given view and retrieves a
MotionTransitionState if one exists. MotionModifier if one exists.
- Parameter view: A UIView. - Parameter view: A UIView.
- Returns: An optional MotionTransitionState. - Returns: An optional MotionTargetState.
*/ */
subscript(view: UIView) -> MotionTransitionState? { subscript(view: UIView) -> MotionTargetState? {
get { get {
return viewToTargetState[view] return viewToTargetState[view]
} }
......
...@@ -28,27 +28,27 @@ ...@@ -28,27 +28,27 @@
import UIKit import UIKit
public class MotionTransition { public final class MotionModifier {
/// A reference to the callback that applies the MotionTransitionState. /// A reference to the callback that applies the MotionModifier.
internal let apply: (inout MotionTransitionState) -> Void internal let apply: (inout MotionTargetState) -> Void
/** /**
An initializer that accepts a given callback. An initializer that accepts a given callback.
- Parameter applyFunction: A given callback. - Parameter applyFunction: A given callback.
*/ */
init(applyFunction: @escaping (inout MotionTransitionState) -> Void) { public init(applyFunction: @escaping (inout MotionTargetState) -> Void) {
apply = applyFunction apply = applyFunction
} }
} }
public extension MotionTransition { public extension MotionModifier {
/** /**
Animates the view with a matching motion identifier. Animates the view with a matching motion identifier.
- Parameter _ identifier: A String. - Parameter _ identifier: A String.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func motionIdentifier(_ identifier: String) -> MotionTransition { static func motionIdentifier(_ identifier: String) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.motionIdentifier = identifier $0.motionIdentifier = identifier
} }
} }
...@@ -58,10 +58,10 @@ public extension MotionTransition { ...@@ -58,10 +58,10 @@ public extension MotionTransition {
given masksToBounds. given masksToBounds.
- Parameter masksToBounds: A boolean value indicating the - Parameter masksToBounds: A boolean value indicating the
masksToBounds state. masksToBounds state.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func masksToBounds(_ masksToBounds: Bool) -> MotionTransition { static func masksToBounds(_ masksToBounds: Bool) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.masksToBounds = masksToBounds $0.masksToBounds = masksToBounds
} }
} }
...@@ -70,10 +70,10 @@ public extension MotionTransition { ...@@ -70,10 +70,10 @@ public extension MotionTransition {
Animates the view's current background color to the Animates the view's current background color to the
given color. given color.
- Parameter color: A UIColor. - Parameter color: A UIColor.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func background(color: UIColor) -> MotionTransition { static func background(color: UIColor) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.backgroundColor = color.cgColor $0.backgroundColor = color.cgColor
} }
} }
...@@ -82,10 +82,10 @@ public extension MotionTransition { ...@@ -82,10 +82,10 @@ public extension MotionTransition {
Animates the view's current border color to the Animates the view's current border color to the
given color. given color.
- Parameter color: A UIColor. - Parameter color: A UIColor.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func border(color: UIColor) -> MotionTransition { static func border(color: UIColor) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.borderColor = color.cgColor $0.borderColor = color.cgColor
} }
} }
...@@ -94,10 +94,10 @@ public extension MotionTransition { ...@@ -94,10 +94,10 @@ public extension MotionTransition {
Animates the view's current border width to the Animates the view's current border width to the
given width. given width.
- Parameter width: A CGFloat. - Parameter width: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func border(width: CGFloat) -> MotionTransition { static func border(width: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.borderWidth = width $0.borderWidth = width
} }
} }
...@@ -106,10 +106,10 @@ public extension MotionTransition { ...@@ -106,10 +106,10 @@ public extension MotionTransition {
Animates the view's current corner radius to the Animates the view's current corner radius to the
given radius. given radius.
- Parameter radius: A CGFloat. - Parameter radius: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func corner(radius: CGFloat) -> MotionTransition { static func corner(radius: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.cornerRadius = radius $0.cornerRadius = radius
} }
} }
...@@ -118,10 +118,10 @@ public extension MotionTransition { ...@@ -118,10 +118,10 @@ public extension MotionTransition {
Animates the view's current transform (perspective, scale, rotate) Animates the view's current transform (perspective, scale, rotate)
to the given one. to the given one.
- Parameter _ transform: A CATransform3D. - Parameter _ transform: A CATransform3D.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func transform(_ transform: CATransform3D) -> MotionTransition { static func transform(_ transform: CATransform3D) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.transform = transform $0.transform = transform
} }
} }
...@@ -130,10 +130,10 @@ public extension MotionTransition { ...@@ -130,10 +130,10 @@ public extension MotionTransition {
Animates the view's current perspective to the given one through Animates the view's current perspective to the given one through
a CATransform3D object. a CATransform3D object.
- Parameter _ perspective: A CGFloat. - Parameter _ perspective: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func perspective(_ perspective: CGFloat) -> MotionTransition { static func perspective(_ perspective: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
var t = $0.transform ?? CATransform3DIdentity var t = $0.transform ?? CATransform3DIdentity
t.m34 = 1 / -perspective t.m34 = 1 / -perspective
$0.transform = t $0.transform = t
...@@ -146,10 +146,10 @@ public extension MotionTransition { ...@@ -146,10 +146,10 @@ public extension MotionTransition {
- Parameter x: A CGFloat. - Parameter x: A CGFloat.
- Parameter y: A CGFloat. - Parameter y: A CGFloat.
- Parameter z: A CGFloat. - Parameter z: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func rotate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> MotionTransition { static func rotate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> MotionModifier {
return MotionTransition { return MotionModifier {
var t = $0.transform ?? CATransform3DIdentity var t = $0.transform ?? CATransform3DIdentity
t = CATransform3DRotate(t, CGFloat(Double.pi) * x / 180, 1, 0, 0) t = CATransform3DRotate(t, CGFloat(Double.pi) * x / 180, 1, 0, 0)
t = CATransform3DRotate(t, CGFloat(Double.pi) * y / 180, 0, 1, 0) t = CATransform3DRotate(t, CGFloat(Double.pi) * y / 180, 0, 1, 0)
...@@ -161,18 +161,18 @@ public extension MotionTransition { ...@@ -161,18 +161,18 @@ public extension MotionTransition {
Animates the view's current rotate to the given point. Animates the view's current rotate to the given point.
- Parameter _ point: A CGPoint. - Parameter _ point: A CGPoint.
- Parameter z: A CGFloat, default is 0. - Parameter z: A CGFloat, default is 0.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func rotate(_ point: CGPoint, z: CGFloat = 0) -> MotionTransition { static func rotate(_ point: CGPoint, z: CGFloat = 0) -> MotionModifier {
return .rotate(x: point.x, y: point.y, z: z) return .rotate(x: point.x, y: point.y, z: z)
} }
/** /**
Rotate 2d. Rotate 2d.
- Parameter _ z: A CGFloat. - Parameter _ z: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func rotate(_ z: CGFloat) -> MotionTransition { static func rotate(_ z: CGFloat) -> MotionModifier {
return .rotate(z: z) return .rotate(z: z)
} }
...@@ -181,10 +181,10 @@ public extension MotionTransition { ...@@ -181,10 +181,10 @@ public extension MotionTransition {
- Parameter x: A CGFloat. - Parameter x: A CGFloat.
- Parameter y: A CGFloat. - Parameter y: A CGFloat.
- Parameter z: A CGFloat. - Parameter z: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func scale(x: CGFloat = 1, y: CGFloat = 1, z: CGFloat = 1) -> MotionTransition { static func scale(x: CGFloat = 1, y: CGFloat = 1, z: CGFloat = 1) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.transform = CATransform3DScale($0.transform ?? CATransform3DIdentity, x, y, z) $0.transform = CATransform3DScale($0.transform ?? CATransform3DIdentity, x, y, z)
} }
} }
...@@ -192,9 +192,9 @@ public extension MotionTransition { ...@@ -192,9 +192,9 @@ public extension MotionTransition {
/** /**
Animates the view's current x & y scale to the given scale value. Animates the view's current x & y scale to the given scale value.
- Parameter _ xy: A CGFloat. - Parameter _ xy: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func scale(_ xy: CGFloat) -> MotionTransition { static func scale(_ xy: CGFloat) -> MotionModifier {
return .scale(x: xy, y: xy) return .scale(x: xy, y: xy)
} }
...@@ -204,10 +204,10 @@ public extension MotionTransition { ...@@ -204,10 +204,10 @@ public extension MotionTransition {
- Parameter x: A CGFloat. - Parameter x: A CGFloat.
- Parameter y: A CGFloat. - Parameter y: A CGFloat.
- Parameter z: A CGFloat. - Parameter z: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func translate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> MotionTransition { static func translate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.transform = CATransform3DTranslate($0.transform ?? CATransform3DIdentity, x, y, z) $0.transform = CATransform3DTranslate($0.transform ?? CATransform3DIdentity, x, y, z)
} }
} }
...@@ -217,19 +217,19 @@ public extension MotionTransition { ...@@ -217,19 +217,19 @@ public extension MotionTransition {
point value (x & y), and a z value. point value (x & y), and a z value.
- Parameter _ point: A CGPoint. - Parameter _ point: A CGPoint.
- Parameter z: A CGFloat, default is 0. - Parameter z: A CGFloat, default is 0.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func translate(_ point: CGPoint, z: CGFloat = 0) -> MotionTransition { static func translate(_ point: CGPoint, z: CGFloat = 0) -> MotionModifier {
return .translate(x: point.x, y: point.y, z: z) return .translate(x: point.x, y: point.y, z: z)
} }
/** /**
Animates the view's current position to the given point. Animates the view's current position to the given point.
- Parameter _ point: A CGPoint. - Parameter _ point: A CGPoint.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func position(_ point: CGPoint) -> MotionTransition { static func position(_ point: CGPoint) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.position = point $0.position = point
} }
} }
...@@ -238,30 +238,30 @@ public extension MotionTransition { ...@@ -238,30 +238,30 @@ public extension MotionTransition {
Animates a view's current position to the given x and y values. Animates a view's current position to the given x and y values.
- Parameter x: A CGloat. - Parameter x: A CGloat.
- Parameter y: A CGloat. - Parameter y: A CGloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func position(x: CGFloat, y: CGFloat) -> MotionTransition { static func position(x: CGFloat, y: CGFloat) -> MotionModifier {
return .position(CGPoint(x: x, y: y)) return .position(CGPoint(x: x, y: y))
} }
/// Forces the view to not fade during a transition. /// Forces the view to not fade during a transition.
static var forceNonFade = MotionTransition { static var forceNonFade = MotionModifier {
$0.nonFade = true $0.nonFade = true
} }
/// Fades the view in during a transition. /// Fades the view in during a transition.
static var fadeIn = MotionTransition.fade(1) static var fadeIn = MotionModifier.fade(1)
/// Fades the view out during a transition. /// Fades the view out during a transition.
static var fadeOut = MotionTransition.fade(0) static var fadeOut = MotionModifier.fade(0)
/** /**
Animates the view's current opacity to the given one. Animates the view's current opacity to the given one.
- Parameter to opacity: A Double. - Parameter to opacity: A Double.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func fade(_ opacity: Double) -> MotionTransition { static func fade(_ opacity: Double) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.opacity = opacity $0.opacity = opacity
} }
} }
...@@ -269,10 +269,10 @@ public extension MotionTransition { ...@@ -269,10 +269,10 @@ public extension MotionTransition {
/** /**
Animates the view's current zPosition to the given position. Animates the view's current zPosition to the given position.
- Parameter _ position: An Int. - Parameter _ position: An Int.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func zPosition(_ position: CGFloat) -> MotionTransition { static func zPosition(_ position: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.zPosition = position $0.zPosition = position
} }
} }
...@@ -280,10 +280,10 @@ public extension MotionTransition { ...@@ -280,10 +280,10 @@ public extension MotionTransition {
/** /**
Animates the view's current size to the given one. Animates the view's current size to the given one.
- Parameter _ size: A CGSize. - Parameter _ size: A CGSize.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func size(_ size: CGSize) -> MotionTransition { static func size(_ size: CGSize) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.size = size $0.size = size
} }
} }
...@@ -292,19 +292,19 @@ public extension MotionTransition { ...@@ -292,19 +292,19 @@ public extension MotionTransition {
Animates the view's current size to the given width and height. Animates the view's current size to the given width and height.
- Parameter width: A CGFloat. - Parameter width: A CGFloat.
- Parameter height: A CGFloat. - Parameter height: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func size(width: CGFloat, height: CGFloat) -> MotionTransition { static func size(width: CGFloat, height: CGFloat) -> MotionModifier {
return .size(CGSize(width: width, height: height)) return .size(CGSize(width: width, height: height))
} }
/** /**
Animates the view's current shadow path to the given one. Animates the view's current shadow path to the given one.
- Parameter path: A CGPath. - Parameter path: A CGPath.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func shadow(path: CGPath) -> MotionTransition { static func shadow(path: CGPath) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.shadowPath = path $0.shadowPath = path
} }
} }
...@@ -312,10 +312,10 @@ public extension MotionTransition { ...@@ -312,10 +312,10 @@ public extension MotionTransition {
/** /**
Animates the view's current shadow color to the given one. Animates the view's current shadow color to the given one.
- Parameter color: A UIColor. - Parameter color: A UIColor.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func shadow(color: UIColor) -> MotionTransition { static func shadow(color: UIColor) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.shadowColor = color.cgColor $0.shadowColor = color.cgColor
} }
} }
...@@ -323,10 +323,10 @@ public extension MotionTransition { ...@@ -323,10 +323,10 @@ public extension MotionTransition {
/** /**
Animates the view's current shadow offset to the given one. Animates the view's current shadow offset to the given one.
- Parameter offset: A CGSize. - Parameter offset: A CGSize.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func shadow(offset: CGSize) -> MotionTransition { static func shadow(offset: CGSize) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.shadowOffset = offset $0.shadowOffset = offset
} }
} }
...@@ -334,10 +334,10 @@ public extension MotionTransition { ...@@ -334,10 +334,10 @@ public extension MotionTransition {
/** /**
Animates the view's current shadow opacity to the given one. Animates the view's current shadow opacity to the given one.
- Parameter opacity: A Float. - Parameter opacity: A Float.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func shadow(opacity: Float) -> MotionTransition { static func shadow(opacity: Float) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.shadowOpacity = opacity $0.shadowOpacity = opacity
} }
} }
...@@ -345,10 +345,10 @@ public extension MotionTransition { ...@@ -345,10 +345,10 @@ public extension MotionTransition {
/** /**
Animates the view's current shadow radius to the given one. Animates the view's current shadow radius to the given one.
- Parameter radius: A CGFloat. - Parameter radius: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func shadow(radius: CGFloat) -> MotionTransition { static func shadow(radius: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.shadowRadius = radius $0.shadowRadius = radius
} }
} }
...@@ -356,10 +356,10 @@ public extension MotionTransition { ...@@ -356,10 +356,10 @@ public extension MotionTransition {
/** /**
Animates the view's contents rect to the given one. Animates the view's contents rect to the given one.
- Parameter rect: A CGRect. - Parameter rect: A CGRect.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func contents(rect: CGRect) -> MotionTransition { static func contents(rect: CGRect) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.contentsRect = rect $0.contentsRect = rect
} }
} }
...@@ -367,10 +367,10 @@ public extension MotionTransition { ...@@ -367,10 +367,10 @@ public extension MotionTransition {
/** /**
Animates the view's contents scale to the given one. Animates the view's contents scale to the given one.
- Parameter scale: A CGFloat. - Parameter scale: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func contents(scale: CGFloat) -> MotionTransition { static func contents(scale: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.contentsScale = scale $0.contentsScale = scale
} }
} }
...@@ -378,10 +378,10 @@ public extension MotionTransition { ...@@ -378,10 +378,10 @@ public extension MotionTransition {
/** /**
The duration of the view's animation. The duration of the view's animation.
- Parameter _ duration: A TimeInterval. - Parameter _ duration: A TimeInterval.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func duration(_ duration: TimeInterval) -> MotionTransition { static func duration(_ duration: TimeInterval) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.duration = duration $0.duration = duration
} }
} }
...@@ -390,15 +390,15 @@ public extension MotionTransition { ...@@ -390,15 +390,15 @@ public extension MotionTransition {
Sets the view's animation duration to the longest Sets the view's animation duration to the longest
running animation within a transition. running animation within a transition.
*/ */
static var preferredDurationMatchesLongest = MotionTransition.duration(.infinity) static var preferredDurationMatchesLongest = MotionModifier.duration(.infinity)
/** /**
Delays the animation of a given view. Delays the animation of a given view.
- Parameter _ time: TimeInterval. - Parameter _ time: TimeInterval.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func delay(_ time: TimeInterval) -> MotionTransition { static func delay(_ time: TimeInterval) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.delay = time $0.delay = time
} }
} }
...@@ -406,10 +406,10 @@ public extension MotionTransition { ...@@ -406,10 +406,10 @@ public extension MotionTransition {
/** /**
Sets the view's timing function for the transition. Sets the view's timing function for the transition.
- Parameter _ timingFunction: A CAMediaTimingFunction. - Parameter _ timingFunction: A CAMediaTimingFunction.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func timingFunction(_ timingFunction: CAMediaTimingFunction) -> MotionTransition { static func timingFunction(_ timingFunction: CAMediaTimingFunction) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.timingFunction = timingFunction $0.timingFunction = timingFunction
} }
} }
...@@ -419,11 +419,11 @@ public extension MotionTransition { ...@@ -419,11 +419,11 @@ public extension MotionTransition {
given a stiffness and damping. given a stiffness and damping.
- Parameter stiffness: A CGFlloat. - Parameter stiffness: A CGFlloat.
- Parameter damping: A CGFloat. - Parameter damping: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
@available(iOS 9, *) @available(iOS 9, *)
static func spring(stiffness: CGFloat, damping: CGFloat) -> MotionTransition { static func spring(stiffness: CGFloat, damping: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.spring = (stiffness, damping) $0.spring = (stiffness, damping)
} }
} }
...@@ -433,10 +433,10 @@ public extension MotionTransition { ...@@ -433,10 +433,10 @@ public extension MotionTransition {
a curve in a downward direction, and a value of -1 a curve in a downward direction, and a value of -1
represents a curve in an upward direction. represents a curve in an upward direction.
- Parameter intensity: A CGFloat. - Parameter intensity: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func arc(intensity: CGFloat = 1) -> MotionTransition { static func arc(intensity: CGFloat = 1) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.arc = intensity $0.arc = intensity
} }
} }
...@@ -447,10 +447,10 @@ public extension MotionTransition { ...@@ -447,10 +447,10 @@ public extension MotionTransition {
- Parameter direction: A CascadeDirection. - Parameter direction: A CascadeDirection.
- Parameter animationDelayedUntilMatchedViews: A boolean indicating whether - Parameter animationDelayedUntilMatchedViews: A boolean indicating whether
or not to delay the subview animation until all have started. or not to delay the subview animation until all have started.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func cascade(delta: TimeInterval = 0.02, direction: CascadeDirection = .topToBottom, animationDelayedUntilMatchedViews: Bool = false) -> MotionTransition { static func cascade(delta: TimeInterval = 0.02, direction: CascadeDirection = .topToBottom, animationDelayedUntilMatchedViews: Bool = false) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.cascade = (delta, direction, animationDelayedUntilMatchedViews) $0.cascade = (delta, direction, animationDelayedUntilMatchedViews)
} }
} }
...@@ -459,48 +459,108 @@ public extension MotionTransition { ...@@ -459,48 +459,108 @@ public extension MotionTransition {
Creates an overlay on the animating view with a given color and opacity. Creates an overlay on the animating view with a given color and opacity.
- Parameter color: A UIColor. - Parameter color: A UIColor.
- Parameter opacity: A CGFloat. - Parameter opacity: A CGFloat.
- Returns: A MotionTransition. - Returns: A MotionModifier.
*/ */
static func overlay(color: UIColor, opacity: CGFloat) -> MotionTransition { static func overlay(color: UIColor, opacity: CGFloat) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.overlay = (color.cgColor, opacity) $0.overlay = (color.cgColor, opacity)
} }
} }
} }
public extension MotionTransition { // conditional modifiers
public extension MotionModifier {
/** /**
Apply transitions directly to the view at the start of the transition. Apply modifiers when the condition is true.
The transitions supplied here won't be animated. - Parameter _ condition: A MotionConditionalContext.
For source views, transitions are set directly at the begining of the animation. - Returns: A Boolean.
For destination views, they replace the target state (final appearance).
*/ */
static func beginWith(transitions: [MotionTransition]) -> MotionTransition { static func when(_ condition: @escaping (MotionConditionalContext) -> Bool, _ modifiers: [MotionModifier]) -> MotionModifier {
return MotionTransition {
if $0.beginState == nil { return MotionModifier {
$0.beginState = MotionTransitionStateWrapper(state: []) if nil == $0.conditionalModifiers {
$0.conditionalModifiers = []
}
$0.conditionalModifiers!.append((condition, modifiers))
}
}
static func when(_ condition: @escaping (MotionConditionalContext) -> Bool, _ modifiers: MotionModifier...) -> MotionModifier {
return .when(condition, modifiers)
}
/**
Apply modifiers when matched.
- Parameter _ modifiers: A list of modifiers.
- Returns: A MotionModifier.
*/
static func whenMatched(_ modifiers: MotionModifier...) -> MotionModifier {
return .when({ $0.isMatched }, modifiers)
}
/**
Apply modifiers when presenting.
- Parameter _ modifiers: A list of modifiers.
- Returns: A MotionModifier.
*/
static func whenPresenting(_ modifiers: MotionModifier...) -> MotionModifier {
return .when({ $0.isPresenting }, modifiers)
} }
$0.beginState?.state.append(contentsOf: transitions) /**
Apply modifiers when dismissing.
- Parameter _ modifiers: A list of modifiers.
- Returns: A MotionModifier.
*/
static func whenDismissing(_ modifiers: MotionModifier...) -> MotionModifier {
return .when({ !$0.isPresenting }, modifiers)
} }
/**
Apply modifiers when appearingg.
- Parameter _ modifiers: A list of modifiers.
- Returns: A MotionModifier.
*/
static func whenAppearing(_ modifiers: MotionModifier...) -> MotionModifier {
return .when({ $0.isAppearing }, modifiers)
}
/**
Apply modifiers when disappearing.
- Parameter _ modifiers: A list of modifiers.
- Returns: A MotionModifier.
*/
static func whenDisappearing(_ modifiers: MotionModifier...) -> MotionModifier {
return .when({ !$0.isAppearing }, modifiers)
} }
}
public extension MotionModifier {
/** /**
Apply transitions directly to the view at the start of the transition if the view is Apply transitions directly to the view at the start of the transition.
matched with another view. The transitions supplied here won't be animated. The transitions supplied here won't be animated.
For source views, transitions are set directly at the begining of the animation. For source views, transitions are set directly at the begining of the animation.
For destination views, they replace the target state (final appearance). For destination views, they replace the target state (final appearance).
*/ */
static func beginWithIfMatched(transitions: [MotionTransition]) -> MotionTransition { static func beginWith(_ modifiers: [MotionModifier]) -> MotionModifier {
return MotionTransition { return MotionModifier {
if $0.beginStateIfMatched == nil { if $0.beginState == nil {
$0.beginStateIfMatched = [] $0.beginState = []
} }
$0.beginStateIfMatched?.append(contentsOf: transitions) $0.beginState?.append(contentsOf: modifiers)
} }
} }
static func beginWith(modifiers: [MotionModifier]) -> MotionModifier {
return .beginWith(modifiers)
}
static func beginWith(_ modifiers: MotionModifier...) -> MotionModifier {
return .beginWith(modifiers)
}
/** /**
Use global coordinate space. Use global coordinate space.
...@@ -511,20 +571,20 @@ public extension MotionTransition { ...@@ -511,20 +571,20 @@ public extension MotionTransition {
When a view is matched, this is automatically enabled. When a view is matched, this is automatically enabled.
The `source` transition will also enable this. The `source` transition will also enable this.
*/ */
static var useGlobalCoordinateSpace = MotionTransition { static var useGlobalCoordinateSpace = MotionModifier {
$0.coordinateSpace = .global $0.coordinateSpace = .global
} }
/// Ignore all motion transition attributes for a view's direct subviews. /// Ignore all motion transition attributes for a view's direct subviews.
static var ignoreSubviewTransitions: MotionTransition = .ignoreSubviewTransitions() static var ignoreSubviewTransitions: MotionModifier = .ignoreSubviewTransitions()
/** /**
Ignore all motion transition attributes for a view's subviews. Ignore all motion transition attributes for a view's subviews.
- Parameter recursive: If false, will only ignore direct subviews' transitions. - Parameter recursive: If false, will only ignore direct subviews' transitions.
default false. default false.
*/ */
static func ignoreSubviewTransitions(recursive: Bool = false) -> MotionTransition { static func ignoreSubviewTransitions(recursive: Bool = false) -> MotionModifier {
return MotionTransition { return MotionModifier {
$0.ignoreSubviewTransitions = recursive $0.ignoreSubviewTransitions = recursive
} }
} }
...@@ -537,12 +597,12 @@ public extension MotionTransition { ...@@ -537,12 +597,12 @@ public extension MotionTransition {
This transition actually does nothing by itself since .useOptimizedSnapshot is the default. This transition actually does nothing by itself since .useOptimizedSnapshot is the default.
*/ */
static var useOptimizedSnapshot = MotionTransition { static var useOptimizedSnapshot = MotionModifier {
$0.snapshotType = .optimized $0.snapshotType = .optimized
} }
/// Create a snapshot using snapshotView(afterScreenUpdates:). /// Create a snapshot using snapshotView(afterScreenUpdates:).
static var useNormalSnapshot = MotionTransition { static var useNormalSnapshot = MotionModifier {
$0.snapshotType = .normal $0.snapshotType = .normal
} }
...@@ -551,7 +611,7 @@ public extension MotionTransition { ...@@ -551,7 +611,7 @@ public extension MotionTransition {
This is slower than .useNormalSnapshot but gives more accurate snapshots for some views This is slower than .useNormalSnapshot but gives more accurate snapshots for some views
(eg. UIStackView). (eg. UIStackView).
*/ */
static var useLayerRenderSnapshot = MotionTransition { static var useLayerRenderSnapshot = MotionModifier {
$0.snapshotType = .layerRender $0.snapshotType = .layerRender
} }
...@@ -560,7 +620,7 @@ public extension MotionTransition { ...@@ -560,7 +620,7 @@ public extension MotionTransition {
This will mess up the view hierarchy, therefore, view controllers have to rebuild This will mess up the view hierarchy, therefore, view controllers have to rebuild
their view structure after the transition finishes. their view structure after the transition finishes.
*/ */
static var useNoSnapshot = MotionTransition { static var useNoSnapshot = MotionModifier {
$0.snapshotType = .noSnapshot $0.snapshotType = .noSnapshot
} }
...@@ -568,7 +628,7 @@ public extension MotionTransition { ...@@ -568,7 +628,7 @@ public extension MotionTransition {
Force the view to animate (Motion will create animation contexts & snapshots for them, so Force the view to animate (Motion will create animation contexts & snapshots for them, so
that they can be interactive). that they can be interactive).
*/ */
static var forceAnimate = MotionTransition { static var forceAnimate = MotionModifier {
$0.forceAnimate = true $0.forceAnimate = true
} }
...@@ -577,7 +637,7 @@ public extension MotionTransition { ...@@ -577,7 +637,7 @@ public extension MotionTransition {
a .scale transition. This is to help Motion animate layers that doesn't support bounds animations. a .scale transition. This is to help Motion animate layers that doesn't support bounds animations.
This also gives better performance. This also gives better performance.
*/ */
static var useScaleBasedSizeChange = MotionTransition { static var useScaleBasedSizeChange = MotionModifier {
$0.useScaleBasedSizeChange = true $0.useScaleBasedSizeChange = true
} }
} }
...@@ -125,27 +125,32 @@ class MotionPlugin: MotionCorePreprocessor, MotionAnimator { ...@@ -125,27 +125,32 @@ class MotionPlugin: MotionCorePreprocessor, MotionAnimator {
- state: the target state to override - state: the target state to override
- view: the view to override - view: the view to override
*/ */
open func apply(state: MotionTransitionState, to view: UIView) {} open func apply(state: MotionTargetState, to view: UIView) {}
} }
// methods for enable/disable the current plugin // methods for enable/disable the current plugin
extension MotionPlugin { extension MotionPlugin {
/// A boolean indicating whether plugins are available.
public static var isEnabled: Bool { public static var isEnabled: Bool {
get { get {
return Motion.isEnabled(plugin: self) return MotionTransition.isEnabled(plugin: self)
} }
set { set(value) {
if newValue { if value {
enable() enable()
} else { } else {
disable() disable()
} }
} }
} }
/// Enable plugins.
public static func enable() { public static func enable() {
Motion.enable(plugin: self) MotionTransition.enable(plugin: self)
} }
/// Disable plugins.
public static func disable() { public static func disable() {
Motion.disable(plugin: self) MotionTransition.disable(plugin: self)
} }
} }
/*
* The MIT License (MIT)
*
* Copyright (C) 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Original Inspiration & Author
* Copyright (c) 2016 Luke Zhao <me@lkzhao.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
@objc(MotionState)
public enum MotionState: Int {
/// Motion is able to start a new transition.
case possible
/// UIKit has notified Motion about a pending transition.
/// Motion hasn't started preparation.
case notified
/// Motion's `start` method has been called. Preparing the animation.
case starting
/// Motions's `animate` method has been called. Animation has started.
case animating
/// Motions's `complete` method has been called. Transition has ended or has
/// been cancelled. Motion is cleaning up.
case completing
}
...@@ -28,28 +28,11 @@ ...@@ -28,28 +28,11 @@
import UIKit import UIKit
internal class MotionTransitionStateWrapper { public struct MotionTargetState {
/// A reference to a MotionTransitionState.
internal var state: MotionTransitionState
/**
An initializer that accepts a given MotionTransitionState.
- Parameter state: A MotionTransitionState.
*/
internal init(state: MotionTransitionState) {
self.state = state
}
}
public struct MotionTransitionState {
/// The initial state that the transition will start at. /// The initial state that the transition will start at.
internal var beginState: MotionTransitionStateWrapper? internal var beginState: [MotionModifier]?
public var conditionalTransitions: [((MotionConditionalContext) -> Bool, [MotionTransition])]?
/// The start state if there is a match in the desition view controller. public var conditionalModifiers: [((MotionConditionalContext) -> Bool, [MotionModifier])]?
public var beginStateIfMatched: [MotionTransition]?
/// A reference to the position. /// A reference to the position.
public var position: CGPoint? public var position: CGPoint?
...@@ -154,29 +137,29 @@ public struct MotionTransitionState { ...@@ -154,29 +137,29 @@ public struct MotionTransitionState {
public var custom: [String: Any]? public var custom: [String: Any]?
/** /**
An initializer that accepts an Array of MotionTransitions. An initializer that accepts an Array of MotionTargetStates.
- Parameter transitions: An Array of MotionTransitions. - Parameter transitions: An Array of MotionTargetStates.
*/ */
init(transitions: [MotionTransition]) { init(modifiers: [MotionModifier]) {
append(contentsOf: transitions) append(contentsOf: modifiers)
} }
} }
extension MotionTransitionState { extension MotionTargetState {
/** /**
Adds a MotionTransition to the current state. Adds a MotionTargetState to the current state.
- Parameter _ element: A MotionTransition. - Parameter _ modifier: A MotionTargetState.
*/ */
public mutating func append(_ element: MotionTransition) { public mutating func append(_ modifier: MotionModifier) {
element.apply(&self) modifier.apply(&self)
} }
/** /**
Adds an Array of MotionTransitions to the current state. Adds an Array of MotionTargetStates to the current state.
- Parameter contentsOf elements: An Array of MotionTransitions. - Parameter contentsOf modifiers: An Array of MotionTargetStates.
*/ */
public mutating func append(contentsOf elements: [MotionTransition]) { public mutating func append(contentsOf modifiers: [MotionModifier]) {
for v in elements { for v in modifiers {
v.apply(&self) v.apply(&self)
} }
} }
...@@ -200,12 +183,12 @@ extension MotionTransitionState { ...@@ -200,12 +183,12 @@ extension MotionTransitionState {
} }
} }
extension MotionTransitionState: ExpressibleByArrayLiteral { extension MotionTargetState: ExpressibleByArrayLiteral {
/** /**
An initializer implementing the ExpressibleByArrayLiteral protocol. An initializer implementing the ExpressibleByArrayLiteral protocol.
- Parameter arrayLiteral elements: A list of MotionTransitions. - Parameter arrayLiteral elements: A list of MotionTargetStates.
*/ */
public init(arrayLiteral elements: MotionTransition...) { public init(arrayLiteral elements: MotionModifier...) {
append(contentsOf: elements) append(contentsOf: elements)
} }
} }
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
import Foundation import Foundation
public protocol MotionTransitionObserver { public protocol MotionTargetStateObserver {
/** /**
Executed when the elapsed time changes during a transition. Executed when the elapsed time changes during a transition.
- Parameter transitionObserver: A MotionTransitionObserver. - Parameter transitionObserver: A MotionTargetStateObserver.
- Parameter didUpdateWith elapsedTime: A TimeInterval. - Parameter didUpdateWith elapsedTime: A TimeInterval.
*/ */
func motion(transitionObserver: MotionTransitionObserver, didUpdateWith elapsedTime: TimeInterval) func motion(transitionObserver: MotionTargetStateObserver, didUpdateWith elapsedTime: TimeInterval)
} }
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
import UIKit import UIKit
public struct MotionConditionalContext { public struct MotionConditionalContext {
internal weak var motion: Motion! internal weak var motion: MotionTransition!
public weak var view: UIView! public weak var view: UIView!
public private(set) var isAppearing: Bool public private(set) var isAppearing: Bool
...@@ -97,11 +97,11 @@ class ConditionalPreprocessor: MotionCorePreprocessor { ...@@ -97,11 +97,11 @@ class ConditionalPreprocessor: MotionCorePreprocessor {
func process(views: [UIView], isAppearing: Bool) { func process(views: [UIView], isAppearing: Bool) {
for v in views { for v in views {
guard let conditionalTransitions = context[v]?.conditionalTransitions else { guard let conditionalModifiers = context[v]?.conditionalModifiers else {
continue continue
} }
for (condition, transitions) in conditionalTransitions { for (condition, transitions) 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: transitions)
} }
......
...@@ -40,8 +40,8 @@ class MatchPreprocessor: MotionCorePreprocessor { ...@@ -40,8 +40,8 @@ class MatchPreprocessor: MotionCorePreprocessor {
continue continue
} }
var tvState = context[tv] ?? MotionTransitionState() var tvState = context[tv] ?? MotionTargetState()
var fvState = context[fv] ?? MotionTransitionState() var fvState = context[fv] ?? MotionTargetState()
// match is just a two-way source effect // match is just a two-way source effect
tvState.motionIdentifier = motionIdentifier tvState.motionIdentifier = motionIdentifier
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
import UIKit import UIKit
class MotionCorePreprocessor: MotionPreprocessor { class MotionCorePreprocessor: MotionPreprocessor {
weak public var motion: Motion! weak public var motion: MotionTransition!
/// A reference to the MotionContext. /// A reference to the MotionContext.
public var context: MotionContext! { public var context: MotionContext! {
return motion?.context return motion!.context
} }
func process(fromViews: [UIView], toViews: [UIView]) {} func process(fromViews: [UIView], toViews: [UIView]) {}
......
...@@ -30,7 +30,7 @@ import UIKit ...@@ -30,7 +30,7 @@ import UIKit
public protocol MotionPreprocessor: class { public protocol MotionPreprocessor: class {
/// A reference to Motion. /// A reference to Motion.
weak var motion: Motion! { get set } weak var motion: MotionTransition! { get set }
/** /**
Processes the transitionary views. Processes the transitionary views.
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import UIKit import UIKit
public enum MotionTransitionType { public enum MotionTransitionAnimationType {
public enum Direction { public enum Direction {
case left case left
case right case right
...@@ -50,19 +50,19 @@ public enum MotionTransitionType { ...@@ -50,19 +50,19 @@ public enum MotionTransitionType {
case zoom case zoom
case zoomOut case zoomOut
indirect case selectBy(presenting: MotionTransitionType, dismissing: MotionTransitionType) indirect case selectBy(presenting: MotionTransitionAnimationType, dismissing: MotionTransitionAnimationType)
/** /**
Sets the presenting and dismissing transitions. Sets the presenting and dismissing transitions.
- Parameter presenting: A MotionTransitionType. - Parameter presenting: A MotionTransitionAnimationType.
- Returns: A MotionTransitionType. - Returns: A MotionTransitionAnimationType.
*/ */
public static func autoReverse(presenting: MotionTransitionType) -> MotionTransitionType { public static func autoReverse(presenting: MotionTransitionAnimationType) -> MotionTransitionAnimationType {
return .selectBy(presenting: presenting, dismissing: presenting.reversed()) return .selectBy(presenting: presenting, dismissing: presenting.reversed())
} }
/// Returns a reversal transition. /// Returns a reversal transition.
func reversed() -> MotionTransitionType { func reversed() -> MotionTransitionAnimationType {
switch self { switch self {
case .push(direction: .up): case .push(direction: .up):
return .pull(direction: .down) return .pull(direction: .down)
...@@ -218,7 +218,9 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -218,7 +218,9 @@ class TransitionPreprocessor: MotionCorePreprocessor {
} }
if case .auto = defaultAnimation { if case .auto = defaultAnimation {
if animators.contains(where: { $0.canAnimate(view: tv, isAppearing: true) || $0.canAnimate(view: fv, isAppearing: false) }) { if animators.contains(where: {
$0.canAnimate(view: tv, isAppearing: true) || $0.canAnimate(view: fv, isAppearing: false)
}) {
defaultAnimation = .none defaultAnimation = .none
} else if isNavigationController { } else if isNavigationController {
...@@ -239,7 +241,7 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -239,7 +241,7 @@ class TransitionPreprocessor: MotionCorePreprocessor {
context[fv] = [.timingFunction(.standard), .duration(0.35)] context[fv] = [.timingFunction(.standard), .duration(0.35)]
context[tv] = [.timingFunction(.standard), .duration(0.35)] context[tv] = [.timingFunction(.standard), .duration(0.35)]
let shadowState: [MotionTransition] = [.shadow(opacity: 0.5), let shadowState: [MotionModifier] = [.shadow(opacity: 0.5),
.shadow(color: .black), .shadow(color: .black),
.shadow(radius: 5), .shadow(radius: 5),
.shadow(offset: .zero), .shadow(offset: .zero),
...@@ -247,6 +249,8 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -247,6 +249,8 @@ class TransitionPreprocessor: MotionCorePreprocessor {
switch defaultAnimation { switch defaultAnimation {
case .push(let direction): case .push(let direction):
context.insertToViewFirst = false
context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)), context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)),
.shadow(opacity: 0), .shadow(opacity: 0),
.beginWith(transitions: shadowState), .beginWith(transitions: shadowState),
...@@ -277,6 +281,8 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -277,6 +281,8 @@ class TransitionPreprocessor: MotionCorePreprocessor {
context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)), .scale(0.8)]) context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)), .scale(0.8)])
case .cover(let direction): case .cover(let direction):
context.insertToViewFirst = false
context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)), context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)),
.shadow(opacity: 0), .shadow(opacity: 0),
.beginWith(transitions: shadowState), .beginWith(transitions: shadowState),
...@@ -295,6 +301,8 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -295,6 +301,8 @@ class TransitionPreprocessor: MotionCorePreprocessor {
context[tv]!.append(contentsOf: [.overlay(color: .black, opacity: 0.1)]) context[tv]!.append(contentsOf: [.overlay(color: .black, opacity: 0.1)])
case .pageIn(let direction): case .pageIn(let direction):
context.insertToViewFirst = false
context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)), context[tv]!.append(contentsOf: [.translate(shift(direction: direction, isAppearing: true)),
.shadow(opacity: 0), .shadow(opacity: 0),
.beginWith(transitions: shadowState), .beginWith(transitions: shadowState),
...@@ -333,10 +341,13 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -333,10 +341,13 @@ class TransitionPreprocessor: MotionCorePreprocessor {
case .zoom: case .zoom:
context.insertToViewFirst = true context.insertToViewFirst = true
context[fv]!.append(contentsOf: [.scale(1.3), .fadeOut]) context[fv]!.append(contentsOf: [.scale(1.3), .fadeOut])
context[tv]!.append(contentsOf: [.scale(0.7)]) context[tv]!.append(contentsOf: [.scale(0.7)])
case .zoomOut: case .zoomOut:
context.insertToViewFirst = false
context[tv]!.append(contentsOf: [.scale(1.3), .fadeOut]) context[tv]!.append(contentsOf: [.scale(1.3), .fadeOut])
context[fv]!.append(contentsOf: [.scale(0.7)]) context[fv]!.append(contentsOf: [.scale(0.7)])
...@@ -347,7 +358,7 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -347,7 +358,7 @@ class TransitionPreprocessor: MotionCorePreprocessor {
/** /**
Shifts the transition by a given size. Shifts the transition by a given size.
- Parameter direction: A MotionTransitionType.Direction. - Parameter direction: A MotionTransitionAnimationType.Direction.
- Parameter isAppearing: A boolean indicating whether it is appearing - Parameter isAppearing: A boolean indicating whether it is appearing
or not. or not.
- Parameter size: An optional CGSize. - Parameter size: An optional CGSize.
...@@ -355,7 +366,7 @@ class TransitionPreprocessor: MotionCorePreprocessor { ...@@ -355,7 +366,7 @@ class TransitionPreprocessor: MotionCorePreprocessor {
and `y` point for `x`. and `y` point for `x`.
- Returns: A CGPoint. - Returns: A CGPoint.
*/ */
func shift(direction: MotionTransitionType.Direction, isAppearing: Bool, size: CGSize? = nil, transpose: Bool = false) -> CGPoint { func shift(direction: MotionTransitionAnimationType.Direction, isAppearing: Bool, size: CGSize? = nil, transpose: Bool = false) -> CGPoint {
let size = size ?? context.container.bounds.size let size = size ?? context.container.bounds.size
let point: CGPoint let point: CGPoint
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import UIKit import UIKit
extension Motion { extension MotionTransition {
/// Starts the transition animation. /// Starts the transition animation.
func animate() { func animate() {
guard .starting == state else { guard .starting == state else {
...@@ -85,7 +85,6 @@ extension Motion { ...@@ -85,7 +85,6 @@ extension Motion {
return animator.canAnimate(view: $0, isAppearing: true) return animator.canAnimate(view: $0, isAppearing: true)
}) })
print("T", t, "DURATION", duration)
if .infinity == duration { if .infinity == duration {
animatorWantsInteractive = true animatorWantsInteractive = true
} else { } else {
...@@ -95,12 +94,10 @@ extension Motion { ...@@ -95,12 +94,10 @@ extension Motion {
totalDuration = t totalDuration = t
print("T", t)
if let forceFinishing = forceFinishing { if let forceFinishing = forceFinishing {
complete(isFinishing: forceFinishing) complete(isFinishing: forceFinishing)
} else if let startingProgress = startingProgress { } else if let startingProgress = startingProgress {
update(elapsedTime: startingProgress) update(startingProgress)
} else if animatorWantsInteractive { } else if animatorWantsInteractive {
update(elapsedTime: 0) update(elapsedTime: 0)
} else { } else {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import UIKit import UIKit
extension Motion { extension MotionTransition {
/** /**
Complete the transition. Complete the transition.
- Parameter after: A TimeInterval. - Parameter after: A TimeInterval.
...@@ -36,7 +36,7 @@ extension Motion { ...@@ -36,7 +36,7 @@ extension Motion {
has completed. has completed.
*/ */
func complete(after: TimeInterval, isFinishing: Bool) { func complete(after: TimeInterval, isFinishing: Bool) {
guard [MotionState.animating, .starting, .notified].contains(state) else { guard [MotionTransitionState.animating, .starting, .notified].contains(state) else {
return return
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import UIKit import UIKit
extension Motion { extension MotionTransition {
/// Starts the transition animation. /// Starts the transition animation.
func start() { func start() {
guard .notified == state else { guard .notified == state else {
...@@ -55,7 +55,7 @@ extension Motion { ...@@ -55,7 +55,7 @@ extension Motion {
} }
} }
fileprivate extension Motion { fileprivate extension MotionTransition {
/// Prepares the views frames. /// Prepares the views frames.
func prepareViewFrame() { func prepareViewFrame() {
guard let fv = fromView else { guard let fv = fromView else {
...@@ -119,10 +119,10 @@ fileprivate extension Motion { ...@@ -119,10 +119,10 @@ fileprivate extension Motion {
/// Prepares the animators. /// Prepares the animators.
func prepareAnimators() { func prepareAnimators() {
animators.append(MotionTransitionAnimator<MotionCoreAnimationViewContext>()) animators.append(MotionTargetStateAnimator<MotionCoreAnimationViewContext>())
if #available(iOS 10, tvOS 10, *) { if #available(iOS 10, tvOS 10, *) {
animators.append(MotionTransitionAnimator<MotionViewPropertyViewContext>()) animators.append(MotionTargetStateAnimator<MotionViewPropertyViewContext>())
} }
for v in animators { for v in animators {
...@@ -132,7 +132,7 @@ fileprivate extension Motion { ...@@ -132,7 +132,7 @@ fileprivate extension Motion {
/// Prepares the plugins. /// Prepares the plugins.
func preparePlugins() { func preparePlugins() {
for x in Motion.enabledPlugins.map({ for x in MotionTransition.enabledPlugins.map({
return $0.init() return $0.init()
}) { }) {
plugins.append(x) plugins.append(x)
...@@ -162,7 +162,7 @@ fileprivate extension Motion { ...@@ -162,7 +162,7 @@ fileprivate extension Motion {
container = UIView(frame: transitionContainer?.bounds ?? .zero) container = UIView(frame: transitionContainer?.bounds ?? .zero)
if !toOverFullScreen && !fromOverFullScreen { if !toOverFullScreen && !fromOverFullScreen {
updateContainerBackgroundColor() container.backgroundColor = containerBackgroundColor
} }
transitionContainer?.addSubview(container) transitionContainer?.addSubview(container)
...@@ -243,7 +243,7 @@ fileprivate extension Motion { ...@@ -243,7 +243,7 @@ fileprivate extension Motion {
} }
} }
fileprivate extension Motion { fileprivate extension MotionTransition {
/// Executes the preprocessors' process function. /// Executes the preprocessors' process function.
func processPreprocessors() { func processPreprocessors() {
for v in preprocessors { for v in preprocessors {
......
...@@ -32,81 +32,81 @@ import UIKit ...@@ -32,81 +32,81 @@ import UIKit
public protocol MotionViewControllerDelegate { public protocol MotionViewControllerDelegate {
/** /**
An optional delegation method that is executed motion will start the transition. An optional delegation method that is executed motion will start the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motionWillStartTransition(motion: Motion) optional func motionWillStartTransition(motion: MotionTransition)
/** /**
An optional delegation method that is executed motion did end the transition. An optional delegation method that is executed motion did end the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motionDidEndTransition(motion: Motion) optional func motionDidEndTransition(motion: MotionTransition)
/** /**
An optional delegation method that is executed motion did cancel the transition. An optional delegation method that is executed motion did cancel the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motionDidCancelTransition(motion: Motion) optional func motionDidCancelTransition(motion: MotionTransition)
/** /**
An optional delegation method that is executed when the source An optional delegation method that is executed when the source
view controller will start the transition. view controller will start the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motion(motion: Motion, willStartTransitionFrom viewController: UIViewController) optional func motion(motion: MotionTransition, willStartTransitionFrom viewController: UIViewController)
/** /**
An optional delegation method that is executed when the source An optional delegation method that is executed when the source
view controller did end the transition. view controller did end the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motion(motion: Motion, didEndTransitionFrom viewController: UIViewController) optional func motion(motion: MotionTransition, didEndTransitionFrom viewController: UIViewController)
/** /**
An optional delegation method that is executed when the source An optional delegation method that is executed when the source
view controller did cancel the transition. view controller did cancel the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motion(motion: Motion, didCancelTransitionFrom viewController: UIViewController) optional func motion(motion: MotionTransition, didCancelTransitionFrom viewController: UIViewController)
/** /**
An optional delegation method that is executed when the destination An optional delegation method that is executed when the destination
view controller will start the transition. view controller will start the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motion(motion: Motion, willStartTransitionTo viewController: UIViewController) optional func motion(motion: MotionTransition, willStartTransitionTo viewController: UIViewController)
/** /**
An optional delegation method that is executed when the destination An optional delegation method that is executed when the destination
view controller did end the transition. view controller did end the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motion(motion: Motion, didEndTransitionTo viewController: UIViewController) optional func motion(motion: MotionTransition, didEndTransitionTo viewController: UIViewController)
/** /**
An optional delegation method that is executed when the destination An optional delegation method that is executed when the destination
view controller did cancel the transition. view controller did cancel the transition.
- Parameter motion: A Motion instance. - Parameter motion: A MotionTransition instance.
- Parameter willStartTransitionFrom viewController: A UIViewController. - Parameter willStartTransitionFrom viewController: A UIViewController.
*/ */
@objc @objc
optional func motion(motion: Motion, didCancelTransitionTo viewController: UIViewController) optional func motion(motion: MotionTransition, didCancelTransitionTo viewController: UIViewController)
} }
/** /**
...@@ -122,88 +122,142 @@ public protocol MotionViewControllerDelegate { ...@@ -122,88 +122,142 @@ public protocol MotionViewControllerDelegate {
func update(progress:Double) func update(progress:Double)
func end() func end()
func cancel() func cancel()
func apply(transitions: [MotionTransition], to view: UIView) func apply(transitions: [MotionTargetState], to view: UIView)
``` ```
*/ */
import UIKit import UIKit
public class Motion: NSObject, MotionProgressRunnerDelegate { public class Motion: NSObject {
/// Shared singleton object for controlling the transition /// Shared singleton object for controlling the transition
public static let shared = Motion() public static let shared = MotionTransition()
}
/// A boolean indicating if the user may interact with the
/// view controller while in transition.
public var isUserInteractionEnabled = false
/// A reference to the MotionViewOrderStrategy. public typealias MotionCancelBlock = (Bool) -> Void
public var viewOrderStrategy = MotionViewOrderStrategy.auto
/// Plugins that are enabled during the transition. extension Motion {
internal static var enabledPlugins = [MotionPlugin.Type]() /**
Executes a block of code asynchronously on the main thread.
- Parameter execute: A block that is executed asynchronously on the main thread.
*/
public class func async(_ execute: @escaping () -> Void) {
DispatchQueue.main.async(execute: execute)
}
/// A reference to a fullscreen snapshot. /**
internal var fullScreenSnapshot: UIView! Executes a block of code after a time delay.
- Parameter _ time: A delay time.
- Parameter execute: A block that is executed once delay has passed.
- Returns: An optional MotionCancelBlock.
*/
@discardableResult
public class func delay(_ time: TimeInterval, execute: @escaping () -> Void) -> MotionCancelBlock? {
var cancelable: MotionCancelBlock?
/// A reference to the MotionContext. let delayed: MotionCancelBlock = {
public internal(set) var context: MotionContext! if !$0 {
async(execute)
}
/// A boolean indicating whether the transition interactive or not. cancelable = nil
public var isInteractive: Bool {
return !progressRunner.isRunning
} }
/// Source view controller. cancelable = delayed
public internal(set) var fromViewController: UIViewController?
/// Destination view controller. DispatchQueue.main.asyncAfter(deadline: .now() + time) {
public internal(set) var toViewController: UIViewController? cancelable?(false)
}
/// A reference to the fromView, fromViewController.view. return cancelable
internal var fromView: UIView? {
return fromViewController?.view
} }
/// A reference to the toView, toViewController.view. /**
internal var toView: UIView? { Cancels the delayed MotionCancelBlock.
return toViewController?.view - Parameter delayed completion: An MotionCancelBlock.
*/
public class func cancel(delayed completion: MotionCancelBlock) {
completion(true)
} }
/// The color of the transitioning container. /**
internal var containerBackgroundColor: UIColor? Disables the default animations set on CALayers.
- Parameter animations: A callback that wraps the animations to disable.
*/
public class func disable(_ animations: (() -> Void)) {
animate(duration: 0, animations: animations)
}
/** /**
A UIViewControllerContextTransitioning object provided by UIKit, which Runs an animation with a specified duration.
might be nil when isTransitioning. This happens when calling motionReplaceViewController - Parameter duration: An animation duration time.
- Parameter animations: An animation block.
- Parameter timingFunction: A CAMediaTimingFunction.
- Parameter completion: A completion block that is executed once
the animations have completed.
*/ */
internal weak var transitionContext: UIViewControllerContextTransitioning? public class func animate(duration: CFTimeInterval, timingFunction: CAMediaTimingFunction = .easeInOut, animations: (() -> Void), completion: (() -> Void)? = nil) {
CATransaction.begin()
CATransaction.setAnimationDuration(duration)
CATransaction.setCompletionBlock(completion)
CATransaction.setAnimationTimingFunction(timingFunction)
animations()
CATransaction.commit()
}
/// Progress of the current transition. 0 if no transition is happening. /**
public internal(set) var elapsedTime: TimeInterval = 0 { Creates a CAAnimationGroup.
didSet { - Parameter animations: An Array of CAAnimation objects.
guard .animating == state else { - Parameter timingFunction: A CAMediaTimingFunction.
return - Parameter duration: An animation duration time for the group.
- Returns: A CAAnimationGroup.
*/
public class func animate(group animations: [CAAnimation], timingFunction: CAMediaTimingFunction = .easeInOut, duration: CFTimeInterval = 0.5) -> CAAnimationGroup {
let group = CAAnimationGroup()
group.fillMode = MotionAnimationFillModeToValue(mode: .both)
group.isRemovedOnCompletion = false
group.animations = animations
group.duration = duration
group.timingFunction = timingFunction
return group
} }
}
updateTransitionObservers() public enum MotionTransitionState: Int {
/// Motion is able to start a new transition.
case possible
if isInteractive { /// UIKit has notified Motion about a pending transition.
updateAnimators() /// Motion hasn't started preparation.
} else { case notified
updatePlugins()
}
transitionContext?.updateInteractiveTransition(CGFloat(elapsedTime)) /// Motion's `start` method has been called. Preparing the animation.
} case starting
}
/// Motions's `animate` method has been called. Animation has started.
case animating
/// Motions's `complete` method has been called. Transition has ended or has
/// been cancelled. Motion is cleaning up.
case completing
}
open class MotionTransition: NSObject {
/// Default animation type.
internal var defaultAnimation = MotionTransitionAnimationType.auto
/// The color of the transitioning container.
internal var containerBackgroundColor = UIColor.black
/// A boolean indicating if the user may interact with the
/// view controller while in transition.
public var isUserInteractionEnabled = false
/// A reference to the MotionViewOrderStrategy.
public var viewOrderStrategy = MotionViewOrderStrategy.auto
/// State of the transition. /// State of the transition.
public internal(set) var state = MotionState.possible { public internal(set) var state = MotionTransitionState.possible {
didSet { didSet {
guard .notified != state else { guard .notified != state, .starting != state else {
return
}
guard .starting != state else {
return return
} }
...@@ -220,6 +274,11 @@ public class Motion: NSObject, MotionProgressRunnerDelegate { ...@@ -220,6 +274,11 @@ public class Motion: NSObject, MotionProgressRunnerDelegate {
/// Whether or not we are presenting the destination view controller. /// Whether or not we are presenting the destination view controller.
public internal(set) var isPresenting = true public internal(set) var isPresenting = true
/// A boolean indicating whether the transition interactive or not.
public var isInteractive: Bool {
return !progressRunner.isRunning
}
/** /**
A view container used to hold all the animating views during a A view container used to hold all the animating views during a
transition. transition.
...@@ -235,22 +294,6 @@ public class Motion: NSObject, MotionProgressRunnerDelegate { ...@@ -235,22 +294,6 @@ public class Motion: NSObject, MotionProgressRunnerDelegate {
/// An optional completion callback. /// An optional completion callback.
internal var completionCallback: ((Bool) -> Void)? internal var completionCallback: ((Bool) -> Void)?
/// An Array of observers that are updated during a transition.
internal var transitionObservers: [MotionTransitionObserver]?
/// Max duration used by MotionAnimators and MotionPlugins.
public internal(set) var totalDuration: TimeInterval = 0
/// The currently running animation duration.
internal var currentAnimationDuration: TimeInterval = 0
/// A reference to a MotionProgressRunner.
lazy var progressRunner: MotionProgressRunner = {
let runner = MotionProgressRunner()
runner.delegate = self
return runner
}()
/// A boolean indicating if the transition has finished. /// A boolean indicating if the transition has finished.
internal var isFinishing = true internal var isFinishing = true
...@@ -267,8 +310,68 @@ public class Motion: NSObject, MotionProgressRunnerDelegate { ...@@ -267,8 +310,68 @@ public class Motion: NSObject, MotionProgressRunnerDelegate {
internal var animatingFromViews = [UIView]() internal var animatingFromViews = [UIView]()
internal var animatingToViews = [UIView]() internal var animatingToViews = [UIView]()
/// Default animation type. /// Plugins that are enabled during the transition.
internal var defaultAnimation = MotionTransitionType.auto internal static var enabledPlugins = [MotionPlugin.Type]()
/// Source view controller.
public internal(set) var fromViewController: UIViewController?
/// A reference to the fromView, fromViewController.view.
internal var fromView: UIView? {
return fromViewController?.view
}
/// Destination view controller.
public internal(set) var toViewController: UIViewController?
/// A reference to the toView, toViewController.view.
internal var toView: UIView? {
return toViewController?.view
}
/// An Array of observers that are updated during a transition.
internal var transitionObservers: [MotionTargetStateObserver]?
/// Max duration used by MotionAnimators and MotionPlugins.
public internal(set) var totalDuration: TimeInterval = 0
/**
A UIViewControllerContextTransitioning object provided by UIKit, which
might be nil when isTransitioning. This happens when calling motionReplaceViewController
*/
internal weak var transitionContext: UIViewControllerContextTransitioning?
/// A reference to the MotionContext.
public internal(set) var context: MotionContext!
/// A reference to a fullscreen snapshot.
internal var fullScreenSnapshot: UIView?
/// Progress of the current transition. 0 if no transition is happening.
public internal(set) var elapsedTime: TimeInterval = 0 {
didSet {
guard .animating == state else {
return
}
updateTransitionObservers()
if isInteractive {
updateAnimators()
} else {
updatePlugins()
}
transitionContext?.updateInteractiveTransition(CGFloat(elapsedTime))
}
}
/// A reference to a MotionProgressRunner.
lazy var progressRunner: MotionProgressRunner = {
let runner = MotionProgressRunner()
runner.delegate = self
return runner
}()
/** /**
By default, Motion will always appear to be interactive to UIKit. This forces it to appear non-interactive. By default, Motion will always appear to be interactive to UIKit. This forces it to appear non-interactive.
...@@ -314,13 +417,19 @@ public class Motion: NSObject, MotionProgressRunnerDelegate { ...@@ -314,13 +417,19 @@ public class Motion: NSObject, MotionProgressRunnerDelegate {
} }
} }
public extension Motion { extension MotionTransition: MotionProgressRunnerDelegate {
func update(elapsedTime: TimeInterval) {
self.elapsedTime = elapsedTime
}
}
extension MotionTransition {
/** /**
Receive callbacks on each animation frame. Receive callbacks on each animation frame.
Observers will be cleaned when a transition completes. Observers will be cleaned when a transition completes.
- Parameter observer: A MotionTransitionObserver. - Parameter observer: A MotionTargetStateObserver.
*/ */
func addTransitionObserver(observer: MotionTransitionObserver) { func addTransitionObserver(observer: MotionTargetStateObserver) {
if nil == transitionObservers { if nil == transitionObservers {
transitionObservers = [] transitionObservers = []
} }
...@@ -329,7 +438,7 @@ public extension Motion { ...@@ -329,7 +438,7 @@ public extension Motion {
} }
} }
private extension Motion { fileprivate extension MotionTransition {
/// Updates the transition observers. /// Updates the transition observers.
func updateTransitionObservers() { func updateTransitionObservers() {
guard let observers = transitionObservers else { guard let observers = transitionObservers else {
...@@ -358,44 +467,19 @@ private extension Motion { ...@@ -358,44 +467,19 @@ private extension Motion {
} }
} }
public extension Motion { public extension MotionTransition {
/** /**
Updates the elapsed time for the interactive transition. Updates the elapsed time for the interactive transition.
- Parameter elapsedTime t: the current progress, must be between -1...1. - Parameter elapsedTime t: the current progress, must be between -1...1.
*/ */
public func update(elapsedTime: TimeInterval) { public func update(_ percentageComplete: TimeInterval) {
guard .animating == state else { guard .animating == state else {
startingProgress = elapsedTime startingProgress = percentageComplete
return return
} }
progressRunner.stop() progressRunner.stop()
self.elapsedTime = Double(CGFloat(elapsedTime).clamp(0, 1)) elapsedTime = Double(CGFloat(percentageComplete).clamp(0, 1))
}
/**
Finish the interactive transition.
Will stop the interactive transition and animate from the
current state to the **end** state
- Parameter isAnimated: A boolean indicating if the completion is animated.
*/
public func end(isAnimated: Bool = true) {
guard isTransitioning else {
return
}
guard isAnimated else {
complete(isFinishing: true)
return
}
var t: TimeInterval = 0
for a in animators {
t = max(t, a.resume(at: elapsedTime * totalDuration, isReversed: false))
}
complete(after: t, isFinishing: true)
} }
/** /**
...@@ -436,36 +520,28 @@ public extension Motion { ...@@ -436,36 +520,28 @@ public extension Motion {
Motion.shared.apply([.position(x:50, y:50)], to: view) Motion.shared.apply([.position(x:50, y:50)], to: view)
will set the view's position to 50, 50 will set the view's position to 50, 50
- Parameter transitions: An Array of MotionTransitions. - Parameter modifiers: An Array of MotionModifier.
- Parameter to view: A UIView. - Parameter to view: A UIView.
*/ */
public func apply(transitions: [MotionTransition], to view: UIView) { public func apply(modifiers: [MotionModifier], to view: UIView) {
guard isTransitioning else { guard .animating == state else {
return return
} }
let s = MotionTransitionState(transitions: transitions) let targetState = MotionTargetState(modifiers: modifiers)
let v = context.pairedView(for: view) ?? view if let otherView = context.pairedView(for: view) {
for animator in animators {
for a in animators { animator.apply(state: targetState, to: otherView)
a.apply(state: s, to: v)
} }
} }
}
internal extension Motion {
/// Updates the container background color.
func updateContainerBackgroundColor() {
if let v = containerBackgroundColor {
container?.backgroundColor = v
} else if !toOverFullScreen && !fromOverFullScreen { for animator in self.animators {
container?.backgroundColor = toView?.backgroundColor animator.apply(state: targetState, to: view)
} }
} }
} }
internal extension Motion { internal extension MotionTransition {
/** /**
Checks if a given plugin is enabled. Checks if a given plugin is enabled.
- Parameter plugin: A MotionPlugin.Type. - Parameter plugin: A MotionPlugin.Type.
...@@ -497,7 +573,7 @@ internal extension Motion { ...@@ -497,7 +573,7 @@ internal extension Motion {
} }
} }
public extension Motion { public extension MotionTransition {
/// Turn off built-in animations for the next transition. /// Turn off built-in animations for the next transition.
func disableDefaultAnimationForNextTransition() { func disableDefaultAnimationForNextTransition() {
defaultAnimation = .none defaultAnimation = .none
...@@ -505,23 +581,23 @@ public extension Motion { ...@@ -505,23 +581,23 @@ public extension Motion {
/** /**
Set the default animation for the next transition. This may override the Set the default animation for the next transition. This may override the
root-view's motionTransitions during the transition. root-view's motionModifiers during the transition.
- Parameter animation: A MotionTransitionType. - Parameter animation: A MotionTransitionAnimationType.
*/ */
func setAnimationForNextTransition(_ animation: MotionTransitionType) { func setAnimationForNextTransition(_ animation: MotionTransitionAnimationType) {
defaultAnimation = animation defaultAnimation = animation
} }
/** /**
Set the container background color for the next transition. Set the container background color for the next transition.
- Parameter _ color: An optional UIColor. - Parameter _ color: A UIColor.
*/ */
func setContainerBackgroundColorForNextTransition(_ color: UIColor?) { func setContainerBackgroundColorForNextTransition(_ color: UIColor) {
containerBackgroundColor = color containerBackgroundColor = color
} }
} }
public extension Motion { public extension MotionTransition {
/** /**
A helper transition function. A helper transition function.
- Parameter from: A UIViewController. - Parameter from: A UIViewController.
...@@ -545,7 +621,7 @@ public extension Motion { ...@@ -545,7 +621,7 @@ public extension Motion {
} }
} }
internal extension Motion { internal extension MotionTransition {
/** /**
Processes the start transition delegation methods. Processes the start transition delegation methods.
- Parameter fromViewController: An optional UIViewController. - Parameter fromViewController: An optional UIViewController.
...@@ -661,7 +737,7 @@ internal extension Motion { ...@@ -661,7 +737,7 @@ internal extension Motion {
} }
} }
internal extension Motion { internal extension MotionTransition {
/** /**
Helper for processing the MotionViewControllerDelegate. Helper for processing the MotionViewControllerDelegate.
- Parameter viewController: A UIViewController of type `T`. - Parameter viewController: A UIViewController of type `T`.
...@@ -684,7 +760,7 @@ internal extension Motion { ...@@ -684,7 +760,7 @@ internal extension Motion {
} }
} }
extension Motion: UIViewControllerAnimatedTransitioning { extension MotionTransition: UIViewControllerAnimatedTransitioning {
/** /**
The animation method that is used to coordinate the transition. The animation method that is used to coordinate the transition.
- Parameter using transitionContext: A UIViewControllerContextTransitioning. - Parameter using transitionContext: A UIViewControllerContextTransitioning.
...@@ -716,7 +792,7 @@ extension Motion: UIViewControllerAnimatedTransitioning { ...@@ -716,7 +792,7 @@ extension Motion: UIViewControllerAnimatedTransitioning {
} }
} }
extension Motion: UIViewControllerTransitioningDelegate { extension MotionTransition: UIViewControllerTransitioningDelegate {
/// A reference to the interactive transitioning instance. /// A reference to the interactive transitioning instance.
var interactiveTransitioning: UIViewControllerInteractiveTransitioning? { var interactiveTransitioning: UIViewControllerInteractiveTransitioning? {
return forceNonInteractive ? nil : self return forceNonInteractive ? nil : self
...@@ -755,7 +831,7 @@ extension Motion: UIViewControllerTransitioningDelegate { ...@@ -755,7 +831,7 @@ extension Motion: UIViewControllerTransitioningDelegate {
} }
} }
extension Motion: UIViewControllerInteractiveTransitioning { extension MotionTransition: UIViewControllerInteractiveTransitioning {
public var wantsInteractiveStart: Bool { public var wantsInteractiveStart: Bool {
return true return true
} }
...@@ -765,7 +841,7 @@ extension Motion: UIViewControllerInteractiveTransitioning { ...@@ -765,7 +841,7 @@ extension Motion: UIViewControllerInteractiveTransitioning {
} }
} }
extension Motion: UINavigationControllerDelegate { extension MotionTransition: UINavigationControllerDelegate {
public func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { public func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
guard !isTransitioning else { guard !isTransitioning else {
return nil return nil
...@@ -785,7 +861,7 @@ extension Motion: UINavigationControllerDelegate { ...@@ -785,7 +861,7 @@ extension Motion: UINavigationControllerDelegate {
} }
} }
extension Motion: UITabBarControllerDelegate { extension MotionTransition: UITabBarControllerDelegate {
public func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { public func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if isTransitioning { if isTransitioning {
cancel(isAnimated: false) cancel(isAnimated: false)
...@@ -817,91 +893,3 @@ extension Motion: UITabBarControllerDelegate { ...@@ -817,91 +893,3 @@ extension Motion: UITabBarControllerDelegate {
} }
} }
public typealias MotionCancelBlock = (Bool) -> Void
extension Motion {
/**
Executes a block of code asynchronously on the main thread.
- Parameter execute: A block that is executed asynchronously on the main thread.
*/
public class func async(_ execute: @escaping () -> Void) {
DispatchQueue.main.async(execute: execute)
}
/**
Executes a block of code after a time delay.
- Parameter _ time: A delay time.
- Parameter execute: A block that is executed once delay has passed.
- Returns: An optional MotionCancelBlock.
*/
@discardableResult
public class func delay(_ time: TimeInterval, execute: @escaping () -> Void) -> MotionCancelBlock? {
var cancelable: MotionCancelBlock?
let delayed: MotionCancelBlock = {
if !$0 {
async(execute)
}
cancelable = nil
}
cancelable = delayed
DispatchQueue.main.asyncAfter(deadline: .now() + time) {
cancelable?(false)
}
return cancelable
}
/**
Cancels the delayed MotionCancelBlock.
- Parameter delayed completion: An MotionCancelBlock.
*/
public class func cancel(delayed completion: MotionCancelBlock) {
completion(true)
}
/**
Disables the default animations set on CALayers.
- Parameter animations: A callback that wraps the animations to disable.
*/
public class func disable(_ animations: (() -> Void)) {
animate(duration: 0, animations: animations)
}
/**
Runs an animation with a specified duration.
- Parameter duration: An animation duration time.
- Parameter animations: An animation block.
- Parameter timingFunction: A CAMediaTimingFunction.
- Parameter completion: A completion block that is executed once
the animations have completed.
*/
public class func animate(duration: CFTimeInterval, timingFunction: CAMediaTimingFunction = .easeInOut, animations: (() -> Void), completion: (() -> Void)? = nil) {
CATransaction.begin()
CATransaction.setAnimationDuration(duration)
CATransaction.setCompletionBlock(completion)
CATransaction.setAnimationTimingFunction(timingFunction)
animations()
CATransaction.commit()
}
/**
Creates a CAAnimationGroup.
- Parameter animations: An Array of CAAnimation objects.
- Parameter timingFunction: A CAMediaTimingFunction.
- Parameter duration: An animation duration time for the group.
- Returns: A CAAnimationGroup.
*/
public class func animate(group animations: [CAAnimation], timingFunction: CAMediaTimingFunction = .easeInOut, duration: CFTimeInterval = 0.5) -> CAAnimationGroup {
let group = CAAnimationGroup()
group.fillMode = MotionAnimationFillModeToValue(mode: .both)
group.isRemovedOnCompletion = false
group.animations = animations
group.duration = duration
group.timingFunction = timingFunction
return group
}
}
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