From 00079f0030c8d5e1c1b6a62a39feaeed80bb962d Mon Sep 17 00:00:00 2001 From: Ayden P Date: Mon, 4 Dec 2017 01:42:16 -0500 Subject: [PATCH] Always modify status bar overlay on main thread --- Bank/Views/StatusBarOverlayView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Bank/Views/StatusBarOverlayView.swift b/Bank/Views/StatusBarOverlayView.swift index 6dca8df..7c8b839 100644 --- a/Bank/Views/StatusBarOverlayView.swift +++ b/Bank/Views/StatusBarOverlayView.swift @@ -52,7 +52,12 @@ class StatusBarOverlayView: UIView { var isHairlineVisible = false { didSet { if isHairlineVisible == oldValue { return } - UIView.animate(withDuration: 0.1) { self.hairlineView.alpha = self.isHairlineVisible ? 1 : 0 } + func doAnimate() { + UIView.animate(withDuration: 0.15) { self.hairlineView.alpha = self.isHairlineVisible ? 1 : 0 } + } + if !Thread.isMainThread { + DispatchQueue.main.async { doAnimate() } + } else { doAnimate() } } } }