summaryrefslogtreecommitdiff
path: root/macos/Sources/Helpers/Extensions/NSMenuItem+Extension.swift
blob: e512904ef59e708b5656b7422772671b3ba4a7e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
import AppKit

extension NSMenuItem {
    /// Sets the image property from a symbol if we want images on our menu items.
    func setImageIfDesired(systemSymbolName symbol: String) {
        // We only set on macOS 26 when icons on menu items became the norm.
        if #available(macOS 26, *) {
            image = NSImage(systemSymbolName: symbol, accessibilityDescription: title)
        }
    }
}