{"id":2097,"url":"https://github.com/recruit-mp/ABKit","last_synced_at":"2025-08-02T23:32:03.013Z","repository":{"id":56900127,"uuid":"51568941","full_name":"recruit-mp/ABKit","owner":"recruit-mp","description":"AB testing framework for iOS","archived":false,"fork":false,"pushed_at":"2017-11-02T14:23:16.000Z","size":11912,"stargazers_count":112,"open_issues_count":3,"forks_count":8,"subscribers_count":183,"default_branch":"master","last_synced_at":"2024-12-03T20:36:48.221Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/recruit-mp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-12T05:29:25.000Z","updated_at":"2024-07-22T22:10:53.000Z","dependencies_parsed_at":"2022-08-20T18:20:39.231Z","dependency_job_id":null,"html_url":"https://github.com/recruit-mp/ABKit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-mp%2FABKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-mp%2FABKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-mp%2FABKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-mp%2FABKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recruit-mp","download_url":"https://codeload.github.com/recruit-mp/ABKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228503132,"owners_count":17930517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:03.453Z","updated_at":"2024-12-06T17:30:46.004Z","avatar_url":"https://github.com/recruit-mp.png","language":"Swift","funding_links":[],"categories":["Testing"],"sub_categories":["A/B Testing","Other free courses"],"readme":"# ABKit\n\n![Build Status](https://www.bitrise.io/app/6dbad8f8a5cf175f.svg?token=XbnTW4n4ZLo01_00ePqSbw)\n\nSplit Testing for Swift.\n\nABKit is a library for implementing a simple Split Test that:\n\n- Doesn't require an HTTP client\n- written in Pure Swift\n\n# Installation\n\n## CocoaPods\n\nTo integrate ABKit into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```rb\npod 'ABKit'\n```\n\nThen, run the following command:\n\n```\n$ pod install\n```\n\n# Usage\n\n## A/B Test\n\n```swift\nlet defaultVersion = Version(name: \"A\") { version in print(\"Pattern \\(version.name)\") }\nlet test = SplitTest(name: \"Sample A/B test\", defaultVersion: defaultVersion)\n\nlet b = Version(name: \"B\") { version in print(\"Pattern \\(version.name)\") }\ntest.addVersion(b, weight: 0.5)\n\ntest.run() // A(Default Version) = 50%, B = 50%\n```\n\n## Split Test with Weighted Probabilities\n\n```swift\nlet defaultVersion = Version(name: \"A\") { version in print(\"Pattern \\(version.name)\") }\nlet test = SplitTest(name: \"Sample split test\", defaultVersion: defaultVersion)\n\nlet b = Version(name: \"B\") { version in print(\"Pattern \\(version.name)\") }\ntest.addVersion(b, weight: 0.2)\n\nlet c = Version(name: \"C\") { version in print(\"Pattern \\(version.name)\") }\ntest.addVersion(c, weight: 0.3)\n\ntest.run() // A(Default Version) = 50%, B = 20%, C = 30%\n```\n\n## Conditional Test\n\n```swift\nlet defaultVersion = Version(name: \"A\") { version in print(\"Pattern \\(version.name)\") }\nlet test = ConditionalTest\u003cUser\u003e(name: \"Sample conditional test\", defaultVersion: defaultVersion)\n\nlet b = Version(name: \"B\") { version in print(\"Pattern \\(version.name)\" }\ntest.addVersion(b) { user in user.age \u003c 20 }\n\nlet user = User(name: \"naoty\", age: 28)\ntest.run(user) // If user.age \u003c 20 is true, B will be run otherwise A will be run.\n```\n\n## Pro Tips\n* `ABKit` selects one of the versions using a random number, which is saved in `RandomNumberRepository`. By default, `ABKit` uses `NSUserDefault` as `RandomNumberRepository`. You can save it in any storage by implementing `RandomNumberRepository` protocol.\n*  You can specify an arbitrary number as the random number using `-setRandomNumber(_:)` and reset a random number using `-deleteRandomNumber()` for `SplitTest`.\n\n## License\n\nABKit is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecruit-mp%2FABKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecruit-mp%2FABKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecruit-mp%2FABKit/lists"}