From 16cebcd60a78dc5ec2d84b2af1978f9da64f910f Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 4 May 2024 11:05:45 -0700 Subject: [PATCH] Fix some concurrency warnings. --- iOS/AppDefaults.swift | 2 +- iOS/AppDelegate.swift | 4 +++- iOS/Article/WebViewController.swift | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index 67941933f..1ac38d714 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -31,7 +31,7 @@ final class AppDefaults { static let defaultThemeName = "Defaults" - @MainActor static let shared = AppDefaults() + nonisolated(unsafe) static let shared = AppDefaults() private init() {} static let store: UserDefaults = { diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 6847462bb..e46e67f23 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -391,7 +391,9 @@ private extension AppDelegate { do { try BGTaskScheduler.shared.submit(request) } catch { - os_log(.error, log: self.log, "Could not schedule app refresh: %@", error.localizedDescription) + Task { @MainActor in + os_log(.error, log: self.log, "Could not schedule app refresh: %@", error.localizedDescription) + } } } } diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 057642c3f..38f43333e 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -17,7 +17,8 @@ import ArticleExtractor import Images protocol WebViewControllerDelegate: AnyObject { - func webViewController(_: WebViewController, articleExtractorButtonStateDidUpdate: ArticleExtractorButtonState) + + @MainActor func webViewController(_: WebViewController, articleExtractorButtonStateDidUpdate: ArticleExtractorButtonState) } final class WebViewController: UIViewController {