Skip to content

classic-chris/ios-client

 
 

Repository files navigation

LaunchDarkly SDK for iOS

CircleCI CocoaPods Compatible

Quick setup

  1. Add the SDK to your Podfile:

     pod `LaunchDarkly`
    
  2. Import the LaunchDarkly client:

     #import "LDClient.h"
    
  3. Instantiate a new LDClient with your mobile key and user:

     LDConfigBuilder *config = [[LDConfigBuilder alloc] init];
     [config withMobileKey:@"YOUR_MOBILE_KEY"];
    
     LDUserBuilder *user = [[LDUserBuilder alloc] init];
     user = [user withKey:@"aa0ceb"];
    
     [[LDClient sharedInstance] start:config userBuilder:user];
    

(Be sure to use a mobile key from your environments. Never embed a standard SDK key into a mobile application.)

Your first feature flag

  1. Create a new feature flag on your dashboard

  2. In your application code, use the feature’s key to check whether the flag is on for each user:

     BOOL showFeature = [[LDClient sharedInstance] boolVariation:@"YOUR_FLAG_KEY" fallback:NO];
     if (showFeature) {
             NSLog(@"Showing feature for %@", user.key);
     } else {
             NSLog(@"Not showing feature for user %@", user.key);
     }
    

Manage the feature on your dashboard — control who sees the feature without re-deploying your application!

Learn more

Check out our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.

Testing

We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.

Contributing

See Contributing

About LaunchDarkly

About

LaunchDarkly SDK for iOS

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Objective-C 94.1%
  • Ruby 5.9%