From bcf496e15d6e75bbeeefd1c68ff2233cae539bec Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Tue, 1 Dec 2020 16:17:53 -0500 Subject: [PATCH] Listen for shift-key on launch to run debug code --- Shared/WriteFreely_MultiPlatformApp.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Shared/WriteFreely_MultiPlatformApp.swift b/Shared/WriteFreely_MultiPlatformApp.swift index 4aeb385..29d33cc 100644 --- a/Shared/WriteFreely_MultiPlatformApp.swift +++ b/Shared/WriteFreely_MultiPlatformApp.swift @@ -1,6 +1,21 @@ import SwiftUI @main +struct CheckForDebugModifier { + static func main() { + #if os(macOS) + if NSEvent.modifierFlags.contains(.shift) { + print("Debug launch detected") + // Run debug-mode launch code here + } else { + print("Normal launch detected") + // Don't do anything + } + #endif + WriteFreely_MultiPlatformApp.main() + } +} + struct WriteFreely_MultiPlatformApp: App { @StateObject private var model = WriteFreelyModel()