[0.1.8] Check

This commit is contained in:
Shial 2018-06-21 15:18:04 +10:00
parent 3123be1c7b
commit 51375f6cff
2 changed files with 3 additions and 3 deletions

View File

@ -141,7 +141,7 @@ extension SModalPresentation where Self: UIViewController {
/// - controller: Controller to replace current presented one
/// - animated: Boolean value idicating if operation should be animated
/// - completion: Completion block called on the end of operation
public func sReplace<T: UIViewController>(with controller: T, animated: Bool = false, completion: (() -> Void)? = nil) {
public func sReplace<T: UIViewController>(with controller: T, animated: Bool = false, completion: (() -> Void)? = nil) where T: SModalPresentation {
DispatchQueue.main.async {
if animated {
SModal.modalWindow.isHidden = false
@ -196,8 +196,8 @@ extension SModalPresentation where Self: UIViewController {
return
}
SModal.stack.append(self)
if currentPresented.canDismiss == true {
currentPresented.sWithdraw(animated: animated, completion: completion)
if (currentPresented as? SModalPresentation)?.canDismiss == true {
(currentPresented as? SModalPresentation)?.sWithdraw(animated: animated, completion: completion)
} else {
completion?()
}