Launch another App from your Storyboard App

David Garces
Oct 21, 2015 · 2 min read

This is a short article about my small and quick app that execute another app. If you know the Bundle identifier of the external app you want to launch, you can easily test if the app is running, and launch it using NSWorkspace.sharedWorkspace().

Implementation

There are two main steps you should add to your application:

  1. You should make sure the other application is not running
  2. If it is running you can send a message to the user informing them about this, otherwise you can launch the app and send the result to the user (if required).

This is a snapshot of the code I used to accomplish this, but you can easily download a sample app from: https://github.com/gbdavid2/DavidCodesOSX/tree/master/LaunchAppExample

The app will ask you to write your bundle identifier and will search for another app that uses this bundle identifier before launching it:

LaunchAppExample
LaunchAppExample

Getting Bundle Identifiers

For this sample App I used Apple's default bundle identifier for the Maps App. If you don't know the bundle identifier of the app you need to execute, you may be able to get it by running a script as detailed in this question in StackOverflow.

David codes (swift)

My stories about programming with Swift

David codes (swift)

My stories about programming with Swift

David Garces

Written by

Developer, Technologist and Blogger

David codes (swift)

My stories about programming with Swift