aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/Application.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/Application.swift')
-rw-r--r--WireGuard/WireGuard/UI/macOS/Application.swift17
1 files changed, 17 insertions, 0 deletions
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
+ }
+}