diff --git a/Sources/ProHUD/Alert/AlertProvider.swift b/Sources/ProHUD/Alert/AlertProvider.swift index 1bf4f32..ef4bb7c 100644 --- a/Sources/ProHUD/Alert/AlertProvider.swift +++ b/Sources/ProHUD/Alert/AlertProvider.swift @@ -22,7 +22,7 @@ open class AlertProvider: HUDProviderType { // 详见子类中的 self.init(initializer: nil) return } - Task { + Task { @MainActor in let t = await Target() initializer(t) await t.push() diff --git a/Sources/ProHUD/Capsule/CapsuleProvider.swift b/Sources/ProHUD/Capsule/CapsuleProvider.swift index b0245d6..61cb22b 100644 --- a/Sources/ProHUD/Capsule/CapsuleProvider.swift +++ b/Sources/ProHUD/Capsule/CapsuleProvider.swift @@ -22,7 +22,7 @@ open class CapsuleProvider: HUDProviderType { // 详见子类中的 self.init(initializer: nil) return } - Task { + Task { @MainActor in let t = await Target() initializer(t) await t.push() diff --git a/Sources/ProHUD/Sheet/SheetProvider.swift b/Sources/ProHUD/Sheet/SheetProvider.swift index 881c2d8..7458e9d 100644 --- a/Sources/ProHUD/Sheet/SheetProvider.swift +++ b/Sources/ProHUD/Sheet/SheetProvider.swift @@ -22,7 +22,7 @@ public final class SheetProvider: HUDProviderType { // 详见子类中的 self.init(initializer: nil) return } - Task { + Task { @MainActor in let t = await Target() initializer(t) await t.push() diff --git a/Sources/ProHUD/Toast/ToastProvider.swift b/Sources/ProHUD/Toast/ToastProvider.swift index 19a19bb..a939df2 100644 --- a/Sources/ProHUD/Toast/ToastProvider.swift +++ b/Sources/ProHUD/Toast/ToastProvider.swift @@ -22,7 +22,7 @@ open class ToastProvider: HUDProviderType { // 详见子类中的 self.init(initializer: nil) return } - Task { + Task { @MainActor in let t = await Target() initializer(t) await t.push()