diff --git a/HeliPort/Appearance/Preferences/PrefsSavedNetworksView.swift b/HeliPort/Appearance/Preferences/PrefsSavedNetworksView.swift index 426df15..b304430 100644 --- a/HeliPort/Appearance/Preferences/PrefsSavedNetworksView.swift +++ b/HeliPort/Appearance/Preferences/PrefsSavedNetworksView.swift @@ -79,7 +79,7 @@ class PrefsSavedNetworksView: NSView { return label }() - private let modifyItemSegment: NSSegmentedControl = { + private lazy var modifyItemSegment: NSSegmentedControl = { var removeImage: NSImage var viewImage: NSImage if #available(OSX 11.0, *) { @@ -91,7 +91,7 @@ class PrefsSavedNetworksView: NSView { } let button = NSSegmentedControl(images: [removeImage, viewImage], trackingMode: .momentary, - target: NSSegmentedControl.self, + target: self, action: #selector(modifyItemClicked(_:))) button.setEnabled(false, forSegment: .remove) button.setEnabled(false, forSegment: .view) diff --git a/HeliPort/Appearance/StatusMenu.swift b/HeliPort/Appearance/StatusMenu.swift index d3ca1c0..715155f 100644 --- a/HeliPort/Appearance/StatusMenu.swift +++ b/HeliPort/Appearance/StatusMenu.swift @@ -31,7 +31,7 @@ final class StatusMenu: NSMenu, NSMenuDelegate { private var statusUpdateTimer: Timer? // One instance at a time - private var preferenceWindow: PrefsWindow? + private lazy var preferenceWindow = PrefsWindow() private var status: itl_80211_state = ITL80211_S_INIT { didSet { @@ -444,9 +444,8 @@ final class StatusMenu: NSMenu, NSMenuDelegate { let alert = Alert(text: .notImplemented) alert.show() case .openNetworkPrefs: - preferenceWindow?.close() - preferenceWindow = PrefsWindow() - preferenceWindow?.show() + preferenceWindow.close() + preferenceWindow.show() case .checkUpdates: heliPortUpdater.checkForUpdates(self) case .launchLogin: