From 537133031bc2b2731048d00748c69700e1b48185 Mon Sep 17 00:00:00 2001 From: Rens Breur Date: Tue, 9 Jul 2024 21:52:45 +0200 Subject: [PATCH] Fix build on linux --- Sources/SwiftTUI/RunLoop/Application.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/SwiftTUI/RunLoop/Application.swift b/Sources/SwiftTUI/RunLoop/Application.swift index 9291a84..2972d72 100644 --- a/Sources/SwiftTUI/RunLoop/Application.swift +++ b/Sources/SwiftTUI/RunLoop/Application.swift @@ -1,5 +1,7 @@ import Foundation +#if os(macOS) import AppKit +#endif public class Application { private let node: Node @@ -41,10 +43,12 @@ public class Application { /// The default option, using Dispatch for the main run loop. case dispatch + #if os(macOS) /// This creates and runs an NSApplication with an associated run loop. This allows you /// e.g. to open NSWindows running simultaneously to the terminal app. This requires macOS /// and AppKit. case cocoa + #endif } public func start() { @@ -70,9 +74,11 @@ public class Application { switch runLoopType { case .dispatch: dispatchMain() + #if os(macOS) case .cocoa: NSApplication.shared.setActivationPolicy(.accessory) NSApplication.shared.run() + #endif } }