Thứ Tư, 23 tháng 5, 2018

Multi Thread Swift


// background task
DispatchQueue.global(qos: .userInitiated).async { // Download file or perform expensive task DispatchQueue.main.async { // Update the UI } }

// Delay task
let delay = DispatchTime.now() + .seconds(60)
DispatchQueue.main.asyncAfter(deadline: delay) { // Dodge this! }