Skip to content

Instantly share code, notes, and snippets.

@marmelroy
Created July 3, 2016 10:05
Show Gist options
  • Save marmelroy/51da3e60ae5d732702783b93c580999d to your computer and use it in GitHub Desktop.
Save marmelroy/51da3e60ae5d732702783b93c580999d to your computer and use it in GitHub Desktop.
DispatchQueue.global(attributes: [.qosDefault]).async {
// Background thread
DispatchQueue.main.async(execute: {
// UI Updates
})
}
@JamesPrudente
Copy link

.qosBackground is the default global attribute, so if you want bg you can simplify it like this

DispatchQueue.global().async {
    // Background thread
    DispatchQueue.main.async {
        // UI Updates
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment