diff --git a/Sources/AXPropertyDelegate.swift b/Sources/AXPropertyDelegate.swift index 05fc8b8..e74a6d8 100644 --- a/Sources/AXPropertyDelegate.swift +++ b/Sources/AXPropertyDelegate.swift @@ -1,6 +1,7 @@ import Foundation import AXSwift import PromiseKit +import AppKit /// Implements PropertyDelegate using the AXUIElement API. class AXPropertyDelegate: PropertyDelegate { diff --git a/Sources/Application.swift b/Sources/Application.swift index a018474..90fc023 100644 --- a/Sources/Application.swift +++ b/Sources/Application.swift @@ -112,10 +112,10 @@ final class OSXApplicationDelegate< var isHidden: WriteableProperty>! var processIdentifier: pid_t! - lazy var runningApplication: NSRunningApplication = - NSRunningApplication(processIdentifier: self.processIdentifier)! + lazy var runningApplication: NSRunningApplication? = + NSRunningApplication(processIdentifier: self.processIdentifier) lazy var bundleIdentifier: String? = - self.runningApplication.bundleIdentifier + self.runningApplication?.bundleIdentifier var knownWindows: [WindowDelegate] { return windows.map({ $0 as WindowDelegate })