Manage iOS Flags with Ease

Reduce risk, iterate quicker, and get more control with LaunchDarkly
iOS feature flag management. Try it out free with a 30-day trial.

Try It Free
Feature flag lifecycle management
Feature flag lifecycle management
Manage feature flags across multiple dev environments with flag statuses, audit logging, and custom roles
Feature toggle user and performance feedback
Get feedback without a full release
Release to limited user segments, test your infrastructure, and get the feedback you need to iterate quickly
Feature flags kill switch and feature toggles
Kill bad features without redeploying
Reduce risk and unlock the power of continuous delivery

Mobile iOS Feature Flags

Let's create a mobile iOS feature flag for a "One Click Checkout"

1.Use CocoaPods to install the LaunchDarkly SDK:

Check out our open source mobile iOS SDK on GitHub or read through the reference documentation.

               
       target 'hello-ios' do
         pod 'LaunchDarkly'
       end
                
              

2.Import the LaunchDarkly library

               
         #import "LDClient.h"
                
              

3.Add a user property

               
          @interface ViewController ()
          @property LDUserModel *user;
          @end

          @implementation ViewController
          @synthesize user;
                
              

4.Create a new user

You can pass us any data about users for targeting and segmentation.

               
          LDUserBuilder *builder = [[LDUserBuilder alloc] init];
          builder = [builder withKey:@"bob@example.com"];
          builder = [builder withFirstName:@"Bob"];
          builder = [builder withLastName:@"Loblaw"];

          user = [builder build];

          NSArray *groups = @[@"beta_testers"];
          builder = [builder withCustomArray:@"groups" value:groups];
                
              

5.Create a feature flag in LaunchDarkly

A flag allows you to manage a feature from the LaunchDarkly dashboard.

6.Wrap your code with a feature flag

Create a new LDClient and call 'boolVariation' to check the flag value for the user.

               
            LDConfigBuilder *config = [[LDConfigBuilder alloc] init];
            [config withMobileKey:@"mob-9925194d-c7f1-4266-946f-805f3cc29656"];

            [[LDClient sharedInstance] start:config userBuilder:builder];

          -(void) checkFeatureValue {
            BOOL showFeature = [[LDClient sharedInstance] boolVariation:@"one_click_checkout" default:NO];

            if (showFeature) {
              NSLog(@"showing One Click Checkout feature for %@", user.key);
            } else {
              NSLog(@"not showing One Click Checkout for %@", user.key);
            }
          }
                
              

7.Manage your flag

Use LaunchDarkly to determine which users see the feature.
You can roll out to a percentage of your users or target individual users/groups.

Testimonials
  • LaunchDarkly Testimonial
    I believe that feature flags are a critical piece of modern development, and LaunchDarkly brings this part of continuous delivery to the masses.
    - Rob Zuber, CTO, CircleCI
    LaunchDarkly Testimonial
    LaunchDarkly has been easy to on-board and integrate into our existing development cycle, which has helped us move faster with less risk.
    - Lawrence, VP Engineering, Ten-X

Try LaunchDarkly free for 30 days.

Continuously deliver and deploy software to your users in a faster, more reliable way. Get started today with a 30 day free trial.