Reversi - An elegant A/B testing framework for iOS in Swift.

Couple weeks ago, I heard somebody talking about A/B testing in iOS and how “mobile native A/B testing is hard to implement”. It didn’t sound right to me. So I build a tiny framework for that in Swift. Here is Reversi.

First, let’s go back to A/B testing and feature flags in general. It describe the ability to remotely enable a feature or a different visual for a specific audience without release.

When feature flag is mainly to add a switch in the code base to enable a feature or not, A/B testing go further with specific settings. You can enable a variation based on user language, location, gender but also iOS version, devices etc.


A/B testing is particularly interesting for marketers and measure your app performance. By performance, I mean how good your app convert. That’s the goal of A/B testing, showing variation to improve conversion of specific feature. It can be as simple an image (like often in video games) or the title of the button (eCommerce, shopping).


Today, they are plenty of tools to include A/B testing and feature flagging into your iOS. Although, those tools target marketers and product managers: they try to convince how efficient is their solution. But their SDK integration is often lacking of documentation and API not too user friendly.

I think that’s where the gap is today. As a mobile developer, I would always prefer clean code, easy to test and maintain over complex one in black bock dictated the structure by a third party. That’s how I come with Reversi.


Reversi aims to remove the complexity of it while keeping a clean and maintainable code without relying on third party API.

// feed your configuration to the service from local json or remote service
ReversiService.shared.configure(with: configuration)

label.text = "Hello World"
label.font = UIFont.boldSystemFont(ofSize: 15)
label.textColor = .darkGray

// block will be executed only if "text_variation" experiment is up and running
label.addVariation("text_variation", for: String.self) { label, value in
    label.text = value // "Hello Variation World"

Reversi can supports many type of configuration. The secret lies into the implementation it, so you can use a remote API or CMS to drive the content without much more effort.

I’ve already included some use cases in the Github repo to show how to implement with a local JSON file bundled to your app, but also with other known tools like Firebase, Apptimize or Optimizely.

Apptimize before Reversi

if (Apptimize.isFeatureFlagOn("new_feature_flag_variable")) {
   // ON
} else {
   // OFF

Apptimize with Reversi

myObject.addFeatureFlag("new_feature_flag_variable") { object in

Reversi isn’t designed to replace any A/B testing or feature flagging tools people use today. We still need analysis and other elements to determine if our feature perform. They can do the heavy lifting, Reversi will only make the implementation lighter and easier.

At the end of the day, marketers and product managers will still need developers to include those new feature, but I believe that by having a clean code and and an easier syntax, developers will be faster to implement those variation. Therefore, A/B testing will be faster and easier to implement for everybody.

I’ve been looking for a while for a way to mix software development and growth marketing, I hope that this light A/B testing framework for iOS and written in Swift will make life easier to mobile developers.

Reversi is also my first contribution to the open source world, which is also a learning curve for me, any feedback to make it better.

Thanks for reading

© 2023 Benoit Pasquier. All Rights Reserved
Author's picture

Benoit Pasquier

Software Engineer 🇫🇷, writing about career development, mobile engineering and self-improvement

ShopBack 💰

Singapore 🇸🇬