@@ -4,6 +4,11 @@ import UserNotifications
44
55/// Main app delegate that manages the menu bar item, the refresh timer,
66/// the SwiftUI popover hosting `MenuView`, and sleep/wake handling.
7+///
8+/// Marked `@MainActor` because `ViewModel` is `@MainActor`-isolated and the
9+/// delegate accesses it directly. All `NSApplicationDelegate` methods are
10+/// called on the main thread regardless, so this is semantically correct.
11+@MainActor
712final class AppDelegate: NSObject, NSApplicationDelegate {
813 private var statusItem: NSStatusItem!
914 private var popover: NSPopover!
@@ -96,7 +101,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
96101 let interval = TimeInterval(minutes * 60)
97102
98103 let timer = Timer(timeInterval: interval, repeats: true) { [weak self] _ in
99− self?.viewModel.refresh()
104+ Task { @MainActor in self?.viewModel.refresh() }
100105 }
101106 RunLoop.main.add(timer, forMode: .common)
102107 refreshTimer = timer