Commit 358c2a4c by Daniel Dahan Committed by GitHub

Merge pull request #54 from OrkhanAlikhanov/completion

Added setCompletionCallbackForNextTransition
parents 4a8fa6a7 66bf027f
...@@ -131,8 +131,8 @@ private extension MotionViewTransition { ...@@ -131,8 +131,8 @@ private extension MotionViewTransition {
/// Finalizes the transition. /// Finalizes the transition.
func complete() { func complete() {
clean()
removeAnimations() removeAnimations()
clean()
} }
/// Resets the transition. /// Resets the transition.
......
...@@ -47,16 +47,7 @@ extension MotionTransition { ...@@ -47,16 +47,7 @@ extension MotionTransition {
fromViewController = from fromViewController = from
toViewController = to toViewController = to
completionCallback = { [weak self] in setCompletionCallbackForNextTransition(completion)
guard let `self` = self else {
return
}
completion?($0)
self.state = .possible
}
start() start()
} }
} }
...@@ -576,6 +576,14 @@ public extension MotionTransition { ...@@ -576,6 +576,14 @@ public extension MotionTransition {
func setContainerBackgroundColorForNextTransition(_ color: UIColor) { func setContainerBackgroundColorForNextTransition(_ color: UIColor) {
containerBackgroundColor = color containerBackgroundColor = color
} }
/**
Set the completion callback closure for the next transition.
- Parameter _ completion: An optional closure receiving a Boolean indicating if transition is finishing or cancelling.
*/
func setCompletionCallbackForNextTransition(_ completion: ((Bool) -> Void)?) {
completionCallback = completion
}
} }
internal extension MotionTransition { internal extension MotionTransition {
......
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