- Notifications
You must be signed in to change notification settings - Fork32
Swift SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy).
License
optimizely/swift-sdk
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository houses the Swift SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy) for Mobile and OTT.
Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams, enabling you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more atOptimizely.com, or see thedeveloper documentation.
Optimizely Rollouts isfree feature flags for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap.
Refer to theSwift SDK's developer documentation for detailed instructions on getting started with using the SDK.
- iOS 10.0+ / tvOS 10.0+ / watchOS 3.0+
- Swift 5+
Please note below that<platform> is used to represent the platform on which you are building your app. Currently, we supportiOS,tvOS, andwatchOS platforms.
Add the dependency on the Optimizely Swift SDK with Swift Package Manager inXcode
File->Swift Packages->Add Package Dependency- Enter
https://github.com/optimizely/swift-sdk. - Accept the default rules (
Version: 'Up to Next Major').
If you have a name conflict with other swift packages when you add the Optimizely swift-sdk dependency to Xcode, you can also try with its aliased repo: "https://github.com/optimizely/optimizely-swift-sdk.git".
- Add the following lines to thePodfile:
use_frameworks!pod 'OptimizelySwiftSDK', '~> 5.1.1'
- Run the following command:
pod install
Further installation instructions for Cocoapods:https://guides.cocoapods.org/using/getting-started.html
Add the following lines to theCartfile:
github "optimizely/swift-sdk" ~> 4.1.0Run the following command:
carthage updateLink the frameworks to your project. Go to your project target'sLink Binary With Libraries and drag over the following from theCarthage/Build/<platform> folder:
Optimizely.frameworkTo 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 newRun Script phase in your target'sBuild Phase.
- In the script area include:
/usr/local/bin/carthage copy-frameworks - Add the frameworks to theInput Files list:
$(SRCROOT)/Carthage/Build/<platform>/Optimizely.framework - Add the paths to the copied frameworks to the Output Files list:
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Optimizely.framework
- Add a newRun Script phase in your target'sBuild Phase.
Futher installation instructions for Carthage:https://github.com/Carthage/Carthage
To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely customer success manager.
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 { print(error) }}See the Optimizely Feature Experimentationdeveloper documentation to learn how to set up your first Swift project and use the SDK.
Please seeCONTRIBUTING.
First-party code (under OptimizelySwiftSDK is copyright Optimizely, Inc. and contributors, licensed under Apache 2.0.)
This software incorporates code from the following open source projects:
MurmurHash3:https://github.com/jpedrosa/sua/blob/master/Sources/murmurhash3.swift License (Apache 2.0):https://github.com/jpedrosa/sua/blob/master/LICENSE.txtPorted to Swift4.
SwiftLint:https://github.com/realm/SwiftLint License (MIT):https://github.com/realm/SwiftLint/blob/master/LICENSEUsed to enforce Swift style and conventions.
About
Swift SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy).
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.