Skip to content

Instantly share code, notes, and snippets.

import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
func async<T>(_ executable: @escaping @autoclosure () -> T, _ priority: DispatchQoS.QoSClass = DispatchQoS.QoSClass.default, completion: @escaping (T) -> Void) {
DispatchQueue.global(qos: priority).async {
let result = executable()
DispatchQueue.main.async {