Add UserApp.targetDescriptor.

This commit is contained in:
Brent Simmons 2018-01-15 12:10:57 -08:00
parent eaeb333120
commit c63303f05a
1 changed files with 12 additions and 0 deletions

View File

@ -118,6 +118,18 @@ public final class UserApp {
updateStatus() updateStatus()
return runningApplication?.activate(options: [.activateIgnoringOtherApps]) ?? false return runningApplication?.activate(options: [.activateIgnoringOtherApps]) ?? false
} }
public func targetDescriptor() -> NSAppleEventDescriptor? {
// Requires that the app has previously been launched.
updateStatus()
guard let runningApplication = runningApplication, !runningApplication.isTerminated else {
return nil
}
return NSAppleEventDescriptor(runningApplication: runningApplication)
}
} }