From d055c5b8002fc40a1145e009acab7f61e3528898 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sat, 10 Aug 2019 00:02:27 +0800 Subject: [PATCH] update beta6 --- ProHUD/Guard/GuardController.swift | 7 +++++++ ProHUD/HUDController.swift | 2 ++ 2 files changed, 9 insertions(+) diff --git a/ProHUD/Guard/GuardController.swift b/ProHUD/Guard/GuardController.swift index 485fc96..60cc46c 100644 --- a/ProHUD/Guard/GuardController.swift +++ b/ProHUD/Guard/GuardController.swift @@ -120,6 +120,7 @@ public extension Guard { func pop() { if displaying { debug("pop") + willDisappearCallback?() displaying = false view.isUserInteractionEnabled = false self.removeFromParent() @@ -207,6 +208,12 @@ public extension Guard { return self } + /// 消失事件 + /// - Parameter callback: 事件回调 + @discardableResult func willDisappear(_ callback: (() -> Void)?) -> Guard { + willDisappearCallback = callback + return self + } /// 消失事件 /// - Parameter callback: 事件回调 @discardableResult func didDisappear(_ callback: (() -> Void)?) -> Guard { diff --git a/ProHUD/HUDController.swift b/ProHUD/HUDController.swift index bf6e53f..b2a9808 100644 --- a/ProHUD/HUDController.swift +++ b/ProHUD/HUDController.swift @@ -13,6 +13,7 @@ public class HUDController: UIViewController { /// ID标识 public var identifier = String(Date().timeIntervalSince1970) + internal var willDisappearCallback: (() -> Void)? /// 消失回调 internal var disappearCallback: (() -> Void)? @@ -39,6 +40,7 @@ public class HUDController: UIViewController { // Do any additional setup after loading the view. } + public override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) disappearCallback?()