Latest 1.1.8
License Apache License, Version 2.0
Platforms ios 9.0
Dependencies BMSCore, SwiftyJSON

IBM Cloud Mobile Services – AppLaunch iOS Swift Client SDK

Build Status

This Swift SDK for App Launch on IBM Cloud services, provides a library for developers to build mobile applications on iOS devices.

App Launch on IBM Cloud services enables the developers to build engaging apps by controlling reach and roll out of App features while measuring the defined metrics.

Ensure that you go through IBM Cloud App Launch service documentation before you start.

Build Status

Master Development
Build Status Build Status


Setup App Launch Service

Creating the service

Create feature

Creating a feature

Create feature

Creating an audience

Create audience

Creating an engagement

Create engagement


  • iOS 10+
  • Xcode 9
  • Swift 3.2 – 4
  • Cocoapods or Carthage


The Swift SDKs for IBM Cloud Mobile services are available via Cocoapods and Carthage.


To install AppLaunch using Cocoapods, add it to your Podfile:


target 'MyApp' do
    platform :ios, '9.0'
    pod 'IBMAppLaunch'
    pod 'BMSCore', '~> 2.0'
    pod 'SwiftyJSON'
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.2'

From the Terminal, go to your project folder and install the dependencies with the following command:

pod install

Swift 3.2

Before running the pod install command, make sure to use Cocoapods version 1.1.0.beta.1.

Apps built with Swift 3.2 may receive a message "Convert to Current Swift Syntax?" while opening the project on Xcode 9, make sure you do not convert AppLaunch or BMSCore.

This will installs your dependencies and creates a new Xcode workspace.
Note: Always open a new Xcode workspace instead of the existing xcode project file:


Carthage (coming soon)

Add AppLaunch to your Cartfile in order to install using Carthage.

github "ibm-bluemix-mobile-services/bms-clientsdk-swift-applaunch"

Run the carthage update command. Once built, drag AppLaunch.framework and BMSCore.framework into your Xcode project.

To complete the integration, follow the instructions here.

Enabling iOS applications to use IBM App Launch

Import the App launch SDK in your code.

import IBMAppLaunch

Initializing the AppLaunch SDK

1. Build Configuration Object
let config =   AppLaunchConfig.Builder().cacheExpiration(30).eventFlushInterval(60).fetchPolicy(.REFRESH_ON_EXPIRY).build()

The AppLaunchConfig builder is used to customize the following:

  • eventFlushInterval : Sets/Decide the time interval on when the events should be sent to the server. The default value is 30 minutes.

  • cacheExpiration : Sets/Decide the time interval until when the actions should be valid for. The default value is 30 minutes.

    Note : This parameter is effective only if the fetchPolicy is set to RefreshPolicy.REFRESH_ON_EXPIRY or RefreshPolicy.BACKGROUND_REFRESH.

  • fetchPolicy : This parameter decides on how frequently the actions should be fetched from the server. The values can be one of the following:




    The default value is RefreshPolicy.REFRESH_ON_EVERY_START.

  • deviceId: This parameter must be unique. If not specified, default deviceID generation mechanism is used by SDK.

    Note: Do not rely on the default implementation of the deviceID generation mechanism as it is not guarenteed to be unique.

2. Build User Object
let user = AppLaunchUser.Builder(userId: "vittal").custom(key: "email", value: "[email protected]").build()

The AppLaunchUser builder is used to provide the following information:

  • userId: The user to be registered

  • custom: This can be used to pass any optional custom user attributes.
3. Initialize App Launch SDK
AppLaunch.sharedInstance.initialize(region: .US_SOUTH, appId: "appGUID", clientSecret: "clientSecret", config: AppLaunchConfig, user: AppLaunchUser, completionHandler: AppLaunchCompletionHandler)

Where region parameter specifies the location where the app is hosted. You can use any of the following values:

  • ICRegion.US_SOUTH
  • ICRegion.SYDNEY

The appGUID is the app launch app GUID value, while clientSecret is the appLaunch client secret value which can be obtained from the service console.

AppLaunchCompletionHandler is the completion handler which will be used to notify in case of success and failure events.

Feature Toggle

  • Use the AppLaunch.sharedInstance.isFeatureEnabled(featureCode: "feature code") to check if the feature is enabled for the app.

  • Use the AppLaunch.sharedInstance.getPropertyofFeature(featureCode: "feature code", propertyCode: "property code") to get the value of the particular property in a feature.

    Note :The above two APIs throws applaunchNotIntialized error if isFeatureEnabled or getPropertyofFeature is invoked before initialize API.


To send metrics to the server use the AppLaunch.sharedInstance.sendMetrics() API. This API call sends the metrics information to the server.

AppLaunch.sharedInstance.sendMetrics(code: ["metricCodes"])

Note : The above API throws applaunchNotIntialized error if sendMetrics is invoked before initialize API.

InApp Messages

To display InApp messages invoke the following API.



This method unregisters the user from AppLaunch Service and clears the cache

AppLaunch.sharedInstance.destroy(completionHandler: AppLaunchCompletionHandler)

Samples and Videos

Learn More

Connect with IBM Cloud

YouTube |
Blog |
Facebook |

Latest podspec

    "name": "IBMAppLaunch",
    "version": "1.1.8",
    "summary": "Swift Client SDK for IBM Cloud App Launch Service",
    "description": "IBMu00ae App Launch for IBM Cloud Services enables app owners to launch features to mobile apps at speed and measure their impact by controlling the targeted audience. The service also provides ability to test multiple variants of application features, user interface and messages and empower you to make decisions based on the feedback.",
    "homepage": "",
    "license": "Apache License, Version 2.0",
    "authors": {
        "IBM Cloud Services Mobile SDK": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.8"
    "source_files": "Source/**/*.swift",
    "resources": "Source/UIComponents/*.xib",
    "dependencies": {
        "BMSCore": [
            "~> 2.0"
        "SwiftyJSON": [
            "~> 4.0.0"
    "platforms": {
        "ios": "9.0"
    "pushed_with_swift_version": "3.2"

Pin It on Pinterest

Share This