Skip to content

Instantly share code, notes, and snippets.

@Ikloo
Last active March 19, 2019 15:54
Show Gist options
  • Save Ikloo/ac3ed77ddaf6e06e6b42ff9970cd4e6e to your computer and use it in GitHub Desktop.
Save Ikloo/ac3ed77ddaf6e06e6b42ff9970cd4e6e to your computer and use it in GitHub Desktop.
DispatchQueue extension
extension DispatchQueue {
static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) }
static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) }
static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) }
static var background: DispatchQueue { return DispatchQueue.global(qos: .background) }
func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) {
asyncAfter(deadline: .now() + delay, execute: closure)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment