Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
juancarlostong ci(travis): upload logs to s3 when build fails (#230)
* ci(travis): upload logs to s3 when build fails
Latest commit 8ccb2cb Jun 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
DemoObjCApp (chore): Change pod version to 9.0 (JIRA-4730) (#195) May 24, 2019
DemoSwiftApp (feat): SwiftLint added. (#210) Jun 5, 2019
OptimizelySDK.xcworkspace fix header for future creation Mar 26, 2019
OptimizelySDK Fixes for improving code coverage keeping coveralls coverage report i… Jun 12, 2019
Scripts add force-start simulator before ci tests (#226) Jun 14, 2019
.coveralls.yml (feat): added Code coverage using Coveralls (WIP) (#145) May 24, 2019
.travis.yml ci(travis): upload logs to s3 when build fails (#230) Jun 17, 2019 ci(travis): small fixes (#216) Jun 6, 2019
LICENSE split SDK targets for iOS and tvOS (#15) Jan 14, 2019
OptimizelySwiftSDK.podspec fix scripts for Swift SDK May 1, 2019
Podfile (feat): SwiftLint added. (#210) Jun 5, 2019
Podfile.lock (feat): SwiftLint added. (#210) Jun 5, 2019 fix doc links (#221) Jun 6, 2019


Apache 2.0 Carthage compatible Build Status Coverage Status

This repository houses the Swift SDK for use with Optimizely Full Stack and Optimizely Rollouts for Mobile and OTT.

Optimizely Full Stack is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at, or see the documentation.

Optimizely Rollouts is free feature flags for development teams. Easily roll out and roll back features in any application without code deploys. Mitigate risk for every feature on your roadmap. Learn more at, or see the documentation.

Getting Started

Using the SDK

See the Mobile developer documentation or OTT developer documentation to learn how to set up an Optimizely X project and start using the SDK.


  • iOS 9.0+ / tvOS 9.0+

Installing the SDK

Please note below that <platform> is used to represent the platform on which you are building your app. Currently, we support iOS and tvOS platforms.


  1. Add the following lines to the Podfile:

    pod 'OptimizelySwiftSDK', '3.1.0-beta'

  2. Run the following command:

    pod install

Further installation instructions for Cocoapods:

We haven't actually published to Cocoapods yet.


  1. Add the following lines to the Cartfile:

    github "optimizely/swift-sdk" == 3.1.0-beta

  2. Run the following command:

    carthage update

  3. Link the frameworks to your project. Go to your project target's Link Binary With Libraries and drag over the following from the Carthage/Build/<platform> folder:


  4. To ensure that proper bitcode-related files and dSYMs are copied when archiving your app, you will need to install a Carthage build script:

    • Add a new Run Script phase in your target's Build Phase.
    • In the script area include:
      /usr/local/bin/carthage copy-frameworks
    • Add the frameworks to the Input Files list:

Futher installation instructions for Carthage:

A sample code for SDK initialization and experiments:

let optimizely = OptimizelyClient(sdkKey:"somesdkkey")

optimizely.start{ result in
    do {
        let variation = try optimizely.activate(experimentKey: "background_experiment", userId: "userId", attributes: ["doubleKey":5])
        try optimizely.track(eventKey: "sample_conversion", userId: "userId")
    } catch {




First-party code (under OptimizelySwiftSDK is copyright Optimizely, Inc. and contributors, licensed under Apache 2.0.

Additional Code

This software incorporates code from the following open source repo:

For the SDK: MurmurHash3: License (Apache 2.0): Ported to Swift4.

SwiftLint: License (MIT): Used to enforce Swift style and conventions.

You can’t perform that action at this time.