Reuse delay() function as global macro
This commit is contained in:
parent
5f3ebfd9fe
commit
aea5dc330c
|
@ -61,3 +61,9 @@ extension UIColor {
|
|||
self.init(red: r, green: g, blue: b, alpha: alpha)
|
||||
}
|
||||
}
|
||||
|
||||
func delay(_ block: @escaping () -> Void) {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||
guard error == nil else {
|
||||
|
||||
// XXX: delay to avoid weird toggle state
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
|
||||
delay {
|
||||
cell.setOn(false, animated: true)
|
||||
if error as? ApplicationError == .externalResources {
|
||||
self.requireDownload()
|
||||
|
|
Loading…
Reference in New Issue