Revert presenter dismissal

This commit is contained in:
Andy Uhnak
2022-02-22 16:52:48 +00:00
parent 8fd164bfc5
commit 64930d9da6
2 changed files with 21 additions and 12 deletions
@@ -54,7 +54,6 @@ class FullscreenLoadingIndicatorPresenter: UserIndicatorPresentable {
])
view.alpha = 0
CATransaction.commit()
UIView.animate(withDuration: 0.2) {
view.alpha = 1
}
@@ -65,10 +64,16 @@ class FullscreenLoadingIndicatorPresenter: UserIndicatorPresentable {
return
}
UIView.animate(withDuration: 0.2, delay: 0, options: .beginFromCurrentState) {
view.alpha = 0
} completion: { _ in
view.removeFromSuperview()
// If `present` and `dismiss` are called right after each other without delay,
// the view does not correctly pick up `currentState` of alpha. Dispatching onto
// the main queue skips a few run loops, giving the system time to render
// current state.
DispatchQueue.main.async {
UIView.animate(withDuration: 0.2, delay: 0, options: .beginFromCurrentState) {
view.alpha = 0
} completion: { _ in
view.removeFromSuperview()
}
}
}
}