Getting started with iOS SDK

This section describes how to set up and install the iOS SDK and how to deploy a feature flag.

Step 1 - Setting up the iOS SDK

To setup iOS SDK, follow these steps:

  1. Create a CloudBees Rollout account. See Signup Page to create an account.

  2. Create an application in the CloudBees Rollout dashboard.

    • The first time you log into your account, click the Create New App button to create a new app.

      Create New App button

  3. Get your environment key.

    • Get the key from App Settings > Environment > Key.

Step 2 - Installing the iOS SDK

For instructions on initializing the iOS package to your application., select your installation method:


To install the iOS package, follow these steps:

  1. In the podfile, add the following:

    pod 'ROX'
  2. To install the Cocoapods dependencies, run the following command in the terminal:

    pod install


To install the iOS package, follow these steps:

  1. In the cartfile, add the following:

    github "rollout/rox-ios"
  2. To install the Carthage dependencies, run the following command in the terminal:

    carthage update --platform iOS

Manual installation

To install the iOS package, follow these steps:

  1. If you are already in the manual step screen on the dashboard, click download.

  2. If for some reason you left the installation screen you can go back by clicking on Dashboard > Install Instructions.

  3. Download the zip file and open it. Place the ROX directory under your application.

  4. Add files to your project in Xcode by selecting ROXCore.framework and RoxSdk.xcodeproj.

  5. Remove ROXCore.framework from Linked Frameworks and Libraries.

  6. Click the plus sign (+) under Embedded Binaries and select both ROXCore.framework and ROX.framework.

Add the following lines of code to your application

Swift Objective-c
import ROX

public class flags : RoxContainer {
  // Define the feature flags
  let enableTutorial = RoxFlag()
    // Using a simple singleton pattern
    // a single instance should be used and injected to using classes and unit tests
  let titleColors = ROXVariant(withDefault: "White", options: ["White", "Blue", "Green", "Yellow"])
    static let INSTANCE = flags()

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  //Register the flags instance
    ROX.register("", container: flags.INSTANCE)

  // Setup the environment key
  ROX.setup(withKey: <ROLLOUT_ENV_KEY>)

  return true

flags.INSTANCE.enableTutorial.enabled {
  // TODO: Put your code here that needs to be gated

  switch flags.titleColors!.value()! {
  case "White":
    print("Title color is White")
  case "Blue":
    print("Title color is Blue")
  case "Green":
    print("Title color is Green")
  case "Yellow":
    print("Title color is Yellow")
    print("Title color is default - White")
#import <ROXCore/ROXCore.h>
@interface flags : ROXBaseContainer
@property (nonatomic) ROXFlag* enableTutorial;
@property (nonatomic) ROXVariant* titleColors;

#import "MyContainer.h"
@implementation flags

- (instancetype)init {
  self = [super init];
  if (self) {
    self.enableTutorial = [[ROXFlag alloc] init];
    self.titleColors = [[ROXVariant alloc] initWithDefault:"White" options:@[@"Blue", @"Green", @"Yellow"]];
  return self;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        // Register the flag
    [ROX register:[[flags alloc] init]];

    // Setup the environment key
    [ROX setupWithKey:@<ROLLOUT_ENV_KEY>];

    return YES;

[flags.enableTutorial enabled:^{
  // start the tutorial
} disabled:^{
  // skip the tutorial

if ([flags.titleColors.value isEqualToString:@"Blue"]) {
    NSLog(@"Title color is Blue");
else if ([flags.titleColors.value isEqualToString:@"White"]) {
    NSLog(@"Title color is White");
else if ([flags.titleColors.value isEqualToString:@"Green"]) {
    NSLog(@"Title color is Green");
else if ([flags.titleColors.value isEqualToString:@"Yellow"]) {
    NSLog(@"Title color is Yellow");


Container class registration and environment key setup

  • You cannot call Rox.setup() twice in the same runtime.

Run your application

Running the application

The flag name is automatically added to the CloudBees Rollout dashboard after running the application.

Step 3 - Deploying a feature flag

Finding your flags in the CloudBees Rollout dashboard

After creating feature flags and running your feature code, you can find your flags in the CloudBees Rollout dashboard.

To find your flags in the dashboard:

  1. Find your application in the CloudBees Rollout dashboard. To switch between apps, click on the app name in the top-left corner of the screen and select the app you want from the pulldown.

  2. Click on Flags on the left side of the navigation panel.

  3. Confirm that your flag is listed in the flag view.

Configuring deployment rules

  1. Go to the CloudBees Rollout dashboard.

  2. Click on Experiments on the left panel.

  3. Click the Create Experiment button to create a new experiment.

  4. In the New Experiment window:

    • Find the Flag name from the menu, choose it.

    • Click the Set Audience button to continue. The Experiment Details view appears.

  5. Select either True, False, Split or Scheduled. Split allows you to select the percentage of the target group that you want to deploy. Scheduled allows you to schedule a deployment date.


  6. Click Update Audience.

  • You cannot delete the default condition.

  • You can click the Reset link to go back to the state from before you started making changes. Reset only appears when you’ve made saved modifications.

See Audience for more detailed information.