Swift: How to create a background thread

Background Threads

let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
    // do some task

    dispatch_async(dispatch_get_main_queue()) {
        // update some UI

    }
}
Swift: How to create a background thread Swift: How to create a background thread Reviewed by Edmond Legaspi on Wednesday, January 28, 2015 Rating: 5

No comments:

Powered by Blogger.