SwiftSkyLib
适用于 iOS 和 Mac 的 A/B 测试框架。
该框架使用 Swift,仿照 Object-C 版本的 SkyLab 实现。
用法
要运行示例项目,请克隆仓库,然后在 Example 目录中先运行 pod install
简单 A/B 测试
SwiftSkyLab.abTest("Test1", A: {
print("Test1 - A")
}, B: {
print("Test1 - B")
})
基于加权概率的拆分测试
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")")
}
多元测试
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)")
}
需求
安装
SwiftSkyLib 可通过 CocoaPods 获得。要安装它,请简单地将以下行添加到您的 Podfile 中
pod 'SwiftSkyLib'
作者
fu you fang, [email protected]
许可证
SwiftSkyLib 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。