É uma forma de chamar uma função que ficou rodando no background do sistema, a fim de otimizar o sistema, visto que o Swift permite a execução de funções rodarem paralelamente.
Ela é definida pela função URLSession.shared.dataTask(), que traz consigo os dados, a resposta e se há erro do próprio URL.
import Foundation
let url = URL(string: "<http://www.stackoverflow.com>")!
let task = URLSession.shared.dataTask(with: url, completionHandler: { (data, response, error) in
// Check if there is any HTML data
guard let data = data else { return }
// Make the HTML data readable
let HTMLContent = String(data: data, encoding: .utf8)!
// Show the HTML data
print(HTMLContent)
})
task.resume()