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 {
/// Finalizes the transition.
func complete() {
clean()
removeAnimations()
clean()
}
/// Resets the transition.
......
......@@ -47,16 +47,7 @@ extension MotionTransition {
fromViewController = from
toViewController = to
completionCallback = { [weak self] in
guard let `self` = self else {
return
}
completion?($0)
self.state = .possible
}
setCompletionCallbackForNextTransition(completion)
start()
}
}
......@@ -576,6 +576,14 @@ public extension MotionTransition {
func setContainerBackgroundColorForNextTransition(_ color: UIColor) {
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 {
......
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