Commit 06ec8deb by Daniel Dahan

reworked MotionIndependentController

parent d21da35d
...@@ -29,19 +29,40 @@ ...@@ -29,19 +29,40 @@
import UIKit import UIKit
public class MotionIndependentController: MotionController { public class MotionIndependentController: MotionController {
public override init() { /// An initializer.
super.init() public override init() {
} super.init()
}
public func transition(rootView: UIView, fromViews: [UIView], toViews: [UIView], completion: ((Bool) -> Void)? = nil) { /**
transitionContainer = rootView Transitions source views to their corresponding destination view
completionCallback = completion within a given root view.
- Parameter rootView: A UIView.
- Parameter fromViews: An Array of UIViews.
- Parameter toViews: An Array of UIViews.
- Parameter completion: An optional callback.
*/
public func transition(rootView: UIView, fromViews: [UIView], toViews: [UIView], completion: ((Bool) -> Void)? = nil) {
transitionContainer = rootView
completionCallback = completion
prepareTransition() prepareTransition()
context.defaultCoordinateSpace = .sameParent prepareContext(fromViews: fromViews, toViews: toViews)
context.set(fromViews: fromViews, toViews: toViews) prepareTransitionPairs()
processContext()
prepareTransitionPairs() animate()
animate() }
} }
fileprivate extension MotionIndependentController {
/**
Prepares the context.
- Parameter fromViews: An Array of UIViews.
- PArameter toViews: An Array of UIViews.
*/
func prepareContext(fromViews: [UIView], toViews: [UIView]) {
context.defaultCoordinateSpace = .sameParent
context.set(fromViews: fromViews, toViews: toViews)
processContext()
}
} }
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