The Optimizely X iOS Swift SDK 3.1.0-beta is written completely in Swift and uses all of its native types and patterns. By taking full advantage of the Swift language, it is safer, faster, and more compact compared to the 3.0.x and earlier Optimizely iOS SDKs, which are written in Objective-C.
This beta guide provides specific instructions on installing and using the iOS Swift SDK 3.1.0-beta for these steps:
Install the iOS Swift SDK using CocoaPods or Carthage.
Initialize the iOS Swift SDK and determine how the SDK handles synchronization, datafile polling, and bundled datafiles.
Customize the IOS Swift SDK. The SDK includes three extensible modules defined as protocols to enable customization:
OptimizelyUserProfileService. We provide a default implementation for each module that is used unless replaced with its customized version by client apps when the SDK is initialized. For most apps, these full-featured default implementations should be good as is.
Once you've setup the SDK, you can run experiments and use our feature management and rollout functionality. The information in Run experiments with the iOS Swift SDK is an addendum to the existing 3.x information in the Define Experiments, Get Results, and 3.x API Reference sections. Refer the general information in the appropriate 3.x topic, but be sure to use the correct 3.1.0-beta code examples and resources.
Use the Next link at the bottom of each topic to move through each implementation step in this guide.
- All public types start with the
Optimizelyprefix for clarity and to avoid name conflicts.
- This release includes a wrapper for all public APIs to support Objective-C client applications. See the demo Swift app available on GitHub.
- For Objective-C SDK developers: The iOS SDK 3.1.0-beta includes more streamlined SDK initialization APIs that aren't backwards-compatible with Objective-C SDK 3.0.x and earlier APIs. If you plan to update a legacy Object-C SDK implementation with the new Swift functionality, you'll need to rewrite code for SDK initialization, but this work should be minimal and straightforward.