Creating an iOS Project with Forceios

To create an app, use forceios in a terminal window. The forceios utility gives you two ways to create your app.

  • Specify the type of application you want, along with basic configuration data.


  • Use an existing Mobile SDK app as a template. You still provide the basic configuration data.

You can use forceios in interactive mode with command-line prompts, or in script mode with command-line arguments. To see command usage information, type forceios without arguments.

Be sure to install CocoaPods before using forceios. See iOS Preparation.

For application type, the forceios create command accepts either of the following input values:

App TypeLanguage
Type native_swift (or press RETURN)Swift
Type nativeObjective-C

To use interactive prompts to create an app, open a Terminal window and type forceios create. For example:

This command creates a native iOS Swift app named “testSwift” in the testSwift/ subdirectory of your current directory.

In script mode, you can use forceios without interactive prompts. For example, to create a native app written in Swift:

Or, to create a native app written in Objective-C:

Each of these calls creates a native app named “package-test” and places it in the PackageTest/ subdirectory of your current directory.

The forceios createWithTemplate command is identical to forceios create except that it asks for a GitHub repo URI instead of an app type. You set this URI to point to any repo directory that contains a Mobile SDK app that can be used as a template. Your template app can be any supported Mobile SDK app type. The script changes the template’s identifiers and configuration to match the values you provide for the other parameters.

Before you use createWithTemplate, it's helpful to know which templates are available. To find out, type forceios listtemplates. This command prints a list of templates provided by Mobile SDK. Each listing includes a brief description of the template and its GitHub URI. For example:

Once you've found a template's URI, you can plug it into the forceios command line. Here’s command-line usage information for forceios createWithTemplate:

For any template in the SalesforceMobileSDK-Templates repo, you can drop the path for templaterepouri—just the template name will do. For example:

You can use forceios createWithTemplate interactively or in script mode. For example, here’s a script mode call that uses a specific tag for the template:

This call creates a native Swift app with the same source code and resources as the MobileSyncExplorerSwift sample app. Forceios places the new app in the testWithTemplate/ subdirectory of your current directory. It also changes the app name to “MyMobileSyncExplorer” throughout the project.

To find out which version of forceios you’ve installed, run the following command:

Apps created with forceios are ready to run, right out of the box. After forceios finishes, it prints instructions for opening and running the project from the command line.

If you prefer, you can leave the command line and open your new project manually in Xcode.

  1. In Xcode, select File | Open.
  2. Navigate to the output folder you specified.
  3. Open the workspace file (<*project_name*>.xcworkspace).
  4. When Xcode finishes building, click the Run button.


  • Apps are based on CocoaPods or Swift Package Manager.
  • The script downloads templates at runtime from a GitHub repo.
  • For the forceios create command, the script uses the default templates in the SalesforceMobileSDK-Templates GitHub repo.
  • For templates based on CocoaPods, the script uses npm at runtime to download Mobile SDK libraries. The podfile refers to these libraries with :path => node_modules/... directives.
  • For projects built with Swift Package Manager, the script configures the Xcode project to use the Salesforce Mobile SDK Swift Package published on

See Also