mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-30 04:19:28 +00:00
fix: resolve SwiftUI infinite layout freeze caused by MenuBarExtra isInserted binding to StateObject by using AppStorage
This commit is contained in:
@@ -5,6 +5,7 @@ struct FirelinkApp: App {
|
||||
@StateObject private var settings: AppSettings
|
||||
@StateObject private var controller: DownloadController
|
||||
@StateObject private var schedulerController: SchedulerController
|
||||
@AppStorage("showMenuBarIcon") private var showMenuBarIcon = true
|
||||
|
||||
init() {
|
||||
let settings = AppSettings()
|
||||
@@ -59,7 +60,7 @@ struct FirelinkApp: App {
|
||||
}
|
||||
}
|
||||
|
||||
MenuBarExtra("Firelink", systemImage: "arrow.down.circle", isInserted: $settings.showMenuBarIcon) {
|
||||
MenuBarExtra("Firelink", systemImage: "arrow.down.circle", isInserted: $showMenuBarIcon) {
|
||||
TrayMenuView()
|
||||
.environmentObject(controller)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user