fix iOS 12 behavior when calling dismiss without presentedController, add withAnimationCompletion for StackRoutable
This commit is contained in:
parent
c76079e667
commit
d348414ab7
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TICoordinatorKit'
|
||||
s.version = '1.1.5'
|
||||
s.version = '1.1.7'
|
||||
s.summary = 'A framework for performing navigation in iOS application.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/TICoordinatorKit'
|
||||
s.license = 'Apache License, Version 2.0'
|
||||
|
|
|
|||
|
|
@ -72,11 +72,18 @@ public final class ModalRouter: ModalRoutable {
|
|||
}
|
||||
|
||||
public func dismissModule(animated: Bool, completion: (() -> ())?) {
|
||||
rootController?.dismiss(animated: animated) { [weak self] in
|
||||
self?.topController = self?.rootController
|
||||
self?.childRootControllers = []
|
||||
let dismissCompletion = {
|
||||
self.topController = self.rootController
|
||||
self.childRootControllers = []
|
||||
completion?()
|
||||
}
|
||||
|
||||
guard rootController?.presentedViewController != nil else {
|
||||
dismissCompletion()
|
||||
return
|
||||
}
|
||||
|
||||
rootController?.dismiss(animated: animated, completion: dismissCompletion)
|
||||
}
|
||||
|
||||
public func presentChild(_ module: Presentable?,
|
||||
|
|
|
|||
|
|
@ -51,3 +51,21 @@ public protocol StackRoutable: ModalRoutable {
|
|||
func pop(to module: Presentable?)
|
||||
func pop(to module: Presentable?, animated: Bool)
|
||||
}
|
||||
|
||||
public extension StackRoutable {
|
||||
var headModuleInTheStack: Bool {
|
||||
if let headModule = headModule, headModule.toPresent()?.parent === toPresent() {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func withAnimationCompletion(_ animationCompletion: (() -> Void)?,
|
||||
routerActions: (StackRoutable) -> Void) {
|
||||
CATransaction.begin()
|
||||
CATransaction.setCompletionBlock(animationCompletion)
|
||||
routerActions(self)
|
||||
CATransaction.commit()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue