I\'m very new to a cocoa programming and I can\'t find the way to do the following:
In swift 4, you can use NSWorkspace.shared.launchApplication(appName:) to open an app. It also makes the launched app at front in my case.
You also can try:
do {
try NSWorkspace.shared.launchApplication(at: yourAppURL,
options: .andHideOthers,
configuration: [:])
} catch {
printError("Failed to launch the app.")
}
Option
andHideOthers: Hide all apps except the newly launched one.