Giter Site home page Giter Site logo

sixpack-ios's Introduction

Sixpack-iOS

iOS client library written in Objective-C for SeatGeak's Sixpack ab testing framework.

Version Platform

Installation

CocoaPods

The recommended way to use Sixpack-iOS is through CocoaPods

Sixpack-iOS.podspec is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "Sixpack-iOS"

Manual Installation

If you wish to include Sixpack-iOS manually in your project, you must add the SixPackClient Xcode project to your project's workspace.

You will also have to add the appropriate AFNetworking 2.0 source files to the Sixpack-iOS project in order for linking to complete successfully.

Usage

1. Connect to the Sixpack host

Call connectToHost before any other Sixpack calls. Usually inside: application:didFinishLaunchingWithOptions:

The Url should be the location of your sixpack mountpoint:

[Sixpack connectToHost:@"http://my.sixpack.host:8129/sixpack/mount/point"];

2. Set up the experiments

Call setupExperiment once for each experiment after calling connectToHost and before participating:

[Sixpack setupExperiment:@"myExperiment"
           alternatives:@[@"optionA", @"optionB"];

3. Participate in an experiment

Call participate to participate in an experiment. The chosen alternative is returned in the onChoose block:

[Sixpack participateIn:@"myExperiment"
             onChoose:^(NSString *chosenAlternative) {
        if ([chosenAlternative isEqualToString:@"optionA"]) {
            ... Do option A work
            
        } else if ([chosenAlternative isEqualToString:@"optionB"]) {
            ... Do option B work
        }
    }];

4. Convert

Call convert with the experiment name once the goal is achieved:

[Sixpack convert:@"myExperiment"];

Helper methods

After participating in an experiment, you can retrieve the chosen alternative for that experiment at any time:

+ (NSString *)chosenAlternativeFor:(NSString *)experiment;

After participating in an experiment, you can check for whether a particular alternative was chosen:

+ (BOOL)chosenAlternativeFor:(NSString *)experiment is:(NSString *)alternative;

For Example:

 if ([Sixpack chosenAlternativeFor:@"myExperiment" is:@"optionA"]) {
    [self.view addSubview:self.viewA];
 } else {
    [self.view addSubview:self.viewB];
 }

Debugging

Use this setup method to force an experiment result:

+ (void)setupExperiment:(NSString *)experiment
           alternatives:(NSArray *)alternatives
            forceChoice:(NSString *)forcedChoice;

You can turn on and off debug logging. Logging defaults to On for DEBUG builds and Off for RELEASE builds. You should ensure this is off before submitting to the app store

+ (void)enableDebugLogging:(BOOL)debugLogging;

License

Sixpack-iOS is available under the FreeBSD license. See the LICENSE file for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.