Listen for shift-key on launch to run debug code

This commit is contained in:
Angelo Stavrow 2020-12-01 16:17:53 -05:00
parent b987ab703f
commit bcf496e15d
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -1,6 +1,21 @@
import SwiftUI import SwiftUI
@main @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 { struct WriteFreely_MultiPlatformApp: App {
@StateObject private var model = WriteFreelyModel() @StateObject private var model = WriteFreelyModel()