ROXFlag

@interface ROXFlag : ROXVariant

This class is the API for flags that are controlled by ROX server, Flags are assigned to an experiment and their value is based on experiment container.

  • a property to indicate if the flag is enabled or disabled

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isEnabled;

    Swift

    var isEnabled: Bool { get }
  • Runs block is flag is enabled

    Declaration

    Objective-C

    - (void)enabled:(void (^)(void))codeBlock;

    Swift

    func enabled(_ codeBlock: (() -> Void)!)

    Parameters

    codeBlock

    will get invoked (synchronously) if flag is enabled

  • Runs block is flag is disabled

    Declaration

    Objective-C

    - (void)disabled:(void (^)(void))codeBlock;

    Swift

    func disabled(_ codeBlock: (() -> Void)!)

    Parameters

    codeBlock

    will get invoked (synchronously) if flag is disabled

  • Runs one of the given block based on flag status

    Declaration

    Objective-C

    - (void)enabled:(void (^)(void))enabledCodeBlock
           disabled:(void (^)(void))disabledCodeBlock;

    Swift

    func enabled(_ enabledCodeBlock: (() -> Void)!, disabled disabledCodeBlock: (() -> Void)!)

    Parameters

    enabledCodeBlock

    will get invoked (synchronously) if flag is enabled

    disabledCodeBlock

    will get invoked (synchronously) if flag is disabled

  • Force a value on the flag. This will override any other value (Experiment, Flags View Controller, etc..), and can only be overriden with another call to forceValue:

    Declaration

    Objective-C

    - (void)forceValue:(BOOL)value;

    Swift

    func forceValue(_ value: Bool)

    Parameters

    value

    to force the sdk with

  • Initialize a flag with a default boolean value

    Declaration

    Objective-C

    - (instancetype)initWithDefault:(BOOL)defaultValue;

    Swift

    init!(withDefault defaultValue: Bool)

    Parameters

    defaultValue

    a default value for this flag