fix: Isolate views to @MainActor and use @ObservedObject for Swift 5.7 compatibility #56
@@ -4,8 +4,9 @@ import SwiftUI
|
|||||||
|
|
||||||
/// Sidebar tab showing currently breached thresholds and the in-app
|
/// Sidebar tab showing currently breached thresholds and the in-app
|
||||||
/// alert history log maintained by `AlertEngine`.
|
/// alert history log maintained by `AlertEngine`.
|
||||||
|
@MainActor
|
||||||
public struct AlertsView: View {
|
public struct AlertsView: View {
|
||||||
@State private var engine = AlertEngine.shared
|
@ObservedObject private var engine = AlertEngine.shared
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
@MainActor
|
||||||
public struct ContentView: View {
|
public struct ContentView: View {
|
||||||
@StateObject private var store = SystemTelemetryStore.shared
|
@StateObject private var store = SystemTelemetryStore.shared
|
||||||
@State private var selectedTab: String? = "Dashboard"
|
@State private var selectedTab: String? = "Dashboard"
|
||||||
@@ -1220,6 +1221,7 @@ public struct ContentView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Process Detail Inspector Sheet
|
// MARK: - Process Detail Inspector Sheet
|
||||||
|
@MainActor
|
||||||
struct ProcessDetailSheet: View {
|
struct ProcessDetailSheet: View {
|
||||||
let inspector: MMProcessDetailInspector
|
let inspector: MMProcessDetailInspector
|
||||||
let pid: Int32
|
let pid: Int32
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
@MainActor
|
||||||
public struct QuickGlancePopoverView: View {
|
public struct QuickGlancePopoverView: View {
|
||||||
var store: SystemTelemetryStore
|
@ObservedObject var store: SystemTelemetryStore
|
||||||
|
|
||||||
public init(store: SystemTelemetryStore) {
|
public init(store: SystemTelemetryStore) {
|
||||||
self.store = store
|
self.store = store
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import UserNotifications
|
|||||||
|
|
||||||
/// Preferences UI for threshold alert rules. Bound directly to
|
/// Preferences UI for threshold alert rules. Bound directly to
|
||||||
/// `AlertEngine.shared.configuration`, which auto-persists to `UserDefaults`.
|
/// `AlertEngine.shared.configuration`, which auto-persists to `UserDefaults`.
|
||||||
|
@MainActor
|
||||||
public struct AlertsSettingsView: View {
|
public struct AlertsSettingsView: View {
|
||||||
@ObservedObject private var engine = AlertEngine.shared
|
@ObservedObject private var engine = AlertEngine.shared
|
||||||
@State private var authorizationStatus: UNAuthorizationStatus = .notDetermined
|
@State private var authorizationStatus: UNAuthorizationStatus = .notDetermined
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import XCTest
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
@testable import MacMonitor
|
@testable import MacMonitor
|
||||||
|
|
||||||
|
@MainActor
|
||||||
final class MMMenuBarTests: XCTestCase {
|
final class MMMenuBarTests: XCTestCase {
|
||||||
|
|
||||||
func testMenuBarStatusViewInitialization() {
|
func testMenuBarStatusViewInitialization() {
|
||||||
|
|||||||
Reference in New Issue
Block a user