mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-24 14:37:08 +00:00
18 lines
357 B
Swift
18 lines
357 B
Swift
import Foundation
|
|
|
|
func mainActorWrapped(_ f: @escaping @MainActor () -> Void) -> () -> Void {
|
|
return {
|
|
DispatchQueue.main.async {
|
|
f()
|
|
}
|
|
}
|
|
}
|
|
|
|
func mainActorWrapped<T: Sendable>(_ f: @escaping @MainActor (T) -> Void) -> (T) -> Void {
|
|
return { x in
|
|
DispatchQueue.main.async {
|
|
f(x)
|
|
}
|
|
}
|
|
}
|