Latest 1.0.5
License MIT
Platforms ios 9.3, requires ARC
Dependencies AFNetworking

CI Status


A simple A/B testing framework for remotely switching features on and off and having the changes reflect in the app immediately.



Initialize the defaults with params, a dictionary containing base URLs for staging and production.

NSDictionary *params = @{kRFFeatureToggleBaseURLStringForStagingKey : @"https://staging/",
                         kRFFeatureToggleBaseURLStringForProductionKey : @"https://production/"};

[RFFeatureToggleDefaults sharedDefaultsWithMode:RFFeatureToggleModeProduction params:params];

For an easy start there are 3 convenience methods:

Check if a feature is enabled

[RFeatureToggle isEnabled:@"feature"];

If the API supports features within features within features, these can be separated with dots like

[RFeatureToggle isEnabled:@"feature.subfeature.subsubfeature"];

Refresh all features and cache them

[RFeatureToggle refresh];

This can be called on applicationDidBecomeActive: or whenever convenient. After the initial call the features are automatically refreshed after 24 hours if app has been continuously running in foreground. A custom time interval can be set as default, for example [RFFeatureToggleDefaults sharedDefaults].refreshTimeInterval = 120.0f;.

Fetch all features from the cache

NSArray *features = [RFeatureToggle allFeatures];


Observing updates

Subscribe to RFFeatureToggleUpdatedNotification to receive updates. The notification is triggered only when there has been a change in features.

Switching between modes

To switch between staging and production use

[RFFeatureToggleDefaults switchToMode:RFFeatureToggleModeProduction]

Alternatively, to switch to custom URL that was not provided on initialization, there’s a convenience method

[RFFeatureToggleDefaults switchToCustomModeWithBaseURLString:@"https://testURL"]

Calling [RFFeatureToggleDefaults sharedDefaults].mode)] will return the mode it’s operating in (production, staging, custom).

Fine tuning

For fine tuning check the CocoaDocs.


To inspect the features, there are convenience methods in RFFeature class:

  • description, example output:
feature2: disabled
  • recursiveDescription, example output:
feature2: disabled  
    |_feature3: disabled        
        |_feature5: disabled
        |_feature6: enabled
    |_feature4: enabled


RFFeatureTableViewController lists all features that can be navigated through. It has a refresh control so features can be refreshed to ensure the latest changes are present. This is to be used for QA purposes.


This is demonstrated in the example project. To run the example project, run pod install from the Example directory first.

Digging deeper

Aside convenience methods provided in RFFeatureToggle class, there are model-controller extensions of RFFeature based on Data Mapper design pattern, as well as RFFeatureCache class that handles persistence and auto update. Examples:

To handle error when fetching all features

[RFFeature fetchFeaturesUsingBlock:^(BOOL succeeded, NSError *error) {
    if (!succeeded)
        //handle error

To inspect the date of last successful update

NSTimeInterval secondsSinceLastSuccessfulUpdate = [RFFeatureCache timeIntervalSinceLastSuccessfulUpdate];
if  (secondsSinceLastSuccessfulUpdate > 120.0f)
    //do something


Logging can be configured by calling [RFFeatureToggle setLoggingLevel:]; using one of the predefined logging levels:

  • RFFeatureToggleLogLevelOff: Don’t log anything
  • RFFeatureToggleLoggingLevelError: Log all errors
  • RFFeatureToggleLoggingLevelWarn: Log warnings and errors
  • RFFeatureToggleLoggingLevelInfo: Log informative, warning and error messages
  • RFFeatureToggleLoggingLevelDebug: Log all debug, informative, warning and error messages
  • RFFeatureToggleLoggingLevelVerbose: Log verbose diagnostic, informative, warning and error messages


If it’s available, RFFeatureToggle will direct its logs to CocoaLumberjack. All you need to do is make sure you’ve imported CocoaLumberjack before you import RFFeatureToggle, like so:

#import <CocoaLumberjack/CocoaLumberjack.h>
#import <RFFeatureToggle/RFFeatureToggle.h>


  • A server that returns a list of features in the specified format. See Fixtures for an example of the response.
  • iOS9.3+


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

pod "RFFeatureToggle"


For a complete documentation see CocoaDocs.


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

Latest podspec

    "name": "RFFeatureToggle",
    "version": "1.0.5",
    "license": "MIT",
    "summary": "A simple A/B testing framework for remotely switching features on and off and having the changes reflect in the app immediately.",
    "homepage": "",
    "authors": {
        "Dunja Lalic": "Dunja Lalic "
    "source": {
        "git": "",
        "tag": "1.0.5"
    "platforms": {
        "ios": "9.3"
    "requires_arc": true,
    "screenshots": "",
    "source_files": "RFFeatureToggle/Classes/**/*",
    "dependencies": {
        "AFNetworking": []

Pin It on Pinterest

Share This