/SwiftSkyLab

模仿 SkyLab 写的 Swift 版本的 A/B Test 框架

Primary LanguageSwiftMIT LicenseMIT

SwiftSkyLab

CI Status Version License Platform

适用于 iOS 和 Mac 的 A/B 测试框架。

该框架使用 Swift,模仿 Object-C 版本的 SkyLab 完成。

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Simple A/B Test

SwiftSkyLab.abTest("Test1", A: {
    print("Test1 - A")
}, B: {
    print("Test1 - B")
})

Split Test with Weighted Probabilities

SwiftSkyLab.splitTest("Test2", conditions: [
    "Red" : 0.15,
    "Green" : 0.10,
    "Blue" : 0.50,
    "Purple" : 0.25
]) { (choice) in
    print("Test2 - \(choice ?? "None")")
}

SwiftSkyLab.splitTest("Test4", conditions: [
    "Red",
    "Green",
    "Blue",
    "Purple"
]) { (choice) in
    print("Test4 - \(choice ?? "None")")
}

Multivariate Test

SwiftSkyLab.multivariateTest("Test5", variables: [
    "Red" : 0.15,
    "Green" : 0.10,
    "Blue" : 0.50,
    "Purple" : 0.25
]) { (activeVariables) in
    print("Test5 - \(activeVariables)")
}

SwiftSkyLab.multivariateTest("Test3", variables: [
    "Red",
    "Green",
    "Blue",
    "Purple"
]) { (activeVariables) in
    print("Test3 - \(activeVariables)")
}

Requirements

Installation

SwiftSkyLab is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SwiftSkyLab'

Author

fuyoufang, fuyoufang@163.com

License

SwiftSkyLab is available under the MIT license. See the LICENSE file for more info.