1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-08 05:30:05 +01:00

🏗 Use @MainActor on MainMenu

This commit is contained in:
2022-06-19 13:08:54 +02:00
parent 25a7dded73
commit cf03727dc0

View File

@@ -21,7 +21,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
/** /**
The status bar item with variable length. The status bar item with variable length.
*/ */
let statusItem = NSStatusBar.system.statusItem( @MainActor let statusItem = NSStatusBar.system.statusItem(
withLength: NSStatusItem.variableLength withLength: NSStatusItem.variableLength
) )
@@ -77,7 +77,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
/** /**
Sets the status bar image based on a version string. Sets the status bar image based on a version string.
*/ */
func setStatusBarImage(version: String) { @MainActor func setStatusBarImage(version: String) {
setStatusBar( setStatusBar(
image: (Preferences.preferences[.iconTypeToDisplay] as! String != MenuBarIcon.noIcon.rawValue) image: (Preferences.preferences[.iconTypeToDisplay] as! String != MenuBarIcon.noIcon.rawValue)
? MenuBarImageGenerator.textToImageWithIcon(text: version) ? MenuBarImageGenerator.textToImageWithIcon(text: version)
@@ -89,7 +89,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
Sets the status bar image, based on the provided NSImage. Sets the status bar image, based on the provided NSImage.
The image will be used as a template image. The image will be used as a template image.
*/ */
func setStatusBar(image: NSImage) { @MainActor func setStatusBar(image: NSImage) {
if let button = statusItem.button { if let button = statusItem.button {
image.isTemplate = true image.isTemplate = true
button.image = image button.image = image