From 11140f2289697131b2a590166c17fdd814d3c57f Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sat, 14 Sep 2019 18:11:03 -0500 Subject: [PATCH] Put a slight delay in hiding the progress bar --- iOS/Progress/UINavigationController+Progress.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/iOS/Progress/UINavigationController+Progress.swift b/iOS/Progress/UINavigationController+Progress.swift index d70435ffe..6d80f9b92 100644 --- a/iOS/Progress/UINavigationController+Progress.swift +++ b/iOS/Progress/UINavigationController+Progress.swift @@ -106,8 +106,10 @@ public extension UINavigationController { func finishProgress() { progressView.bar.alpha = 1 progressView.setProgress(1, animated: true) { - UIView.animate(withDuration: 0.5, animations: { self.progressView.bar.alpha = 0 }) { finished in - self.progressView.progress = 0 + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { + UIView.animate(withDuration: 0.5, animations: { self.progressView.bar.alpha = 0 }) { finished in + self.progressView.progress = 0 + } } } } @@ -117,9 +119,11 @@ public extension UINavigationController { */ func cancelProgress() { progressView.setProgress(0, animated: true) { - UIView.animate(withDuration: 0.5, animations: { - self.progressView.bar.alpha = 0 - }) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { + UIView.animate(withDuration: 0.5, animations: { + self.progressView.bar.alpha = 0 + }) + } } }