1
0
peilaus alkaen https://github.com/maxgoedjen/secretive.git synced 2026-01-01 14:28:50 +01:00
secretive/Sources/Secretive/Helpers/MainActorWrappers.swift
2022-06-07 22:02:49 -07:00

18 rivejä
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)
}
}
}