From d151c3c985a834e3b8c2b57f82908d6dfc28c8e9 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Thu, 30 May 2024 11:07:28 +0800 Subject: [PATCH] MainActor --- Sources/ProHUD/Alert/AlertProvider.swift | 2 +- Sources/ProHUD/Capsule/CapsuleProvider.swift | 2 +- Sources/ProHUD/Sheet/SheetProvider.swift | 2 +- Sources/ProHUD/Toast/ToastProvider.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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()