Skip to content

Instantly share code, notes, and snippets.

View Exey's full-sized avatar

Exey Panteleev Exey

View GitHub Profile
@inlinable func trampolineToMain(_ function: @escaping @autoclosure ()->()) -> Bool {
if Thread.isMainThread {
return false
} else {
DispatchQueue.main.async {
function()
}
return true
}
}