From 5c7a149167802902c1632b8062df2969f4680b04 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Sun, 25 Nov 2018 18:42:51 +0530 Subject: macOS: Remove MainMenu.xib When there's no xib, we should explicitly set the app delegate, so we override NSApplication and set the app delegate in NSApplication.shared Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/macOS/Application.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 WireGuard/WireGuard/UI/macOS/Application.swift (limited to 'WireGuard/WireGuard/UI/macOS/Application.swift') diff --git a/WireGuard/WireGuard/UI/macOS/Application.swift b/WireGuard/WireGuard/UI/macOS/Application.swift new file mode 100644 index 0000000..9f7b810 --- /dev/null +++ b/WireGuard/WireGuard/UI/macOS/Application.swift @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018 WireGuard LLC. All Rights Reserved. + +import Cocoa + +var appDelegate: AppDelegate? + +class Application: NSApplication { + // We use a custom Application class to be able to set the app delegate + // before app.run() gets called in NSApplicationMain(). + override class var shared: NSApplication { + let app = NSApplication.shared + appDelegate = AppDelegate() // Keep a strong reference to the app delegate + app.delegate = appDelegate + return app + } +} -- cgit v1.2.3-59-g8ed1b