ROX

public class ROX

ROX class is a static swift class that acts as an facade interface

  • Loads the SDK, usually called as part of AppDelegate.application:didFinishLaunchingWithOptions:

    Checks if a cached experimentation container exists, and loads a container.

    Executes an async network call to fetch the experiment container from the ROX server and calculates experiments and target groups.

    Declaration

    Swift

    public static func setup(withKey key: String)

    Parameters

    key

    The app key (taken from ROX dashboard)

  • Loads the SDK, usually called as part of AppDelegate.application:didFinishLaunchingWithOptions:

    Checks if a cached experimentation container exists, and loads a container.

    Executes an async network call to fetch the experiment container from the ROX server and calculates experiments and target groups.

    Declaration

    Swift

    public static func setup(withKey key: String, options: ROXOptions)

    Parameters

    key

    a unique identifier from type String generated from ROX dashboard

    options

    setup options

  • Register a container instance to ROX system, the same instance can be retrieved by using ROX.getContainer(_:) function

    Note

    this method should be called only once for a given class

    Declaration

    Swift

    public static func register(_ container: RoxContainer)

    Parameters

    container

    The instance to register, this instance values are set at ROX.sync(), ROX.setup(withKey:), or a if the app goes into foreground

  • Retrieve an instance from type clazz that was registered with ROX.register(_:)

    Declaration

    Swift

    public static func getContainer<T:RoxContainer>(_ clazz: T.Type) -> T?

    Parameters

    clazz

    The type of instance you want to retrieve

    Return Value

    The instance that was registered

  • Recalculate the rules of experiments allocation base on new data

    See also

    ROX.unfreeze()

    Note

    Usually called after the user has logged in to refresh ROX custom properties

    Note

    if a flag has already been used (had impression) is is freezed and the calculation will not change the flag state, to change the flag state you need to unfreeze the flag right after the sync call

    Declaration

    Swift

    public static func sync()
  • Unfreeze the state of all flags in code

    When a flag is used in code, his value gets frozen in the app untill the next app foreground event. Calling this function will unfreeze all flags, and using a flag will return it’s most updated value

    Declaration

    Swift

    public static func unfreeze()
  • A view to control feature flags values locally on a mobile device or simulator.

    ROX ViewController allows developers, QA or internal employees (depending on policy) to view, disable, enable and reset the state of their flags locally on the device. The functions return a view controller that can be loaded to the view hierarchy for test devices upon shake, or by triggering an existing debug view in the app.

    Declaration

    Swift

    public static func flagsViewController() -> UIViewController

    Return Value

    ViewController which shows the local feature flags and provides an interface to turn them on or off.

  • Sets a custom property value that can be used when creating target groups.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: String)

    Parameters

    key

    The name of the custom property

    value

    The value of the custom property

  • Sets a custom property value that can be used when creating target groups.

    Declaration

    Swift

    public static func setCustomProperty(key: String, asSemver: Bool, value: String)

    Parameters

    key

    The name of the custom property

    asSemver

    Should the string be computed and treated as a semver (What is Semantic Versioning)

    value

    The value of the custom property

  • Sets a computed custom property value that can be used when creating target groups.

    This method is used when you wish to supply a block of code that will be evaluated on foreground event or when either ROX.sync() , ROX.setup(withKey:) is called.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: @escaping () -> String)

    Parameters

    key

    The name of the custom property

    value

    a code block to returns the value of the custom property

  • Sets a computed custom property value that can be used when creating target groups.

    This method is used when you wish to supply a block of code that will be evaluated on foreground event or when either ROX.sync() , ROX.setup(withKey:) is called.

    Declaration

    Swift

    public static func setCustomProperty(key: String, asSemver: Bool, value: @escaping () -> String)

    Parameters

    asSemver

    Should the string be computed and treated as a semver ([What is Semantic Versioning(http://semver.org/))

    value

    a code block to returns the value of the custom property

  • Sets a custom property value that can be used when creating target groups.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: Bool)

    Parameters

    key

    The name of the custom property

    value

    The value of the custom property

  • Sets a computed custom property value that can be used when creating target groups.

    This method is used when you wish to supply a block of code that will be evaluated on foreground event or when either ROX.sync() , ROX.setup(withKey:) is called.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: @escaping () -> Bool)

    Parameters

    key

    The name of the custom property

    value

    a code block to returns the value of the custom property

  • Sets a custom property value that can be used when creating target groups.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: Int32)

    Parameters

    key

    The name of the custom property

    value

    The value of the custom property

  • Sets a computed custom property value that can be used when creating target groups.

    This method is used when you wish to supply a block of code that will be evaluated on foreground event or when either ROX.sync() , ROX.setup(withKey:) is called.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: @escaping () -> Int32)

    Parameters

    key

    The name of the custom property

    value

    a code block to returns the value of the custom property

  • Sets a custom property value that can be used when creating target groups.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: Double)

    Parameters

    key

    The name of the custom property

    value

    The value of the custom property

  • Sets a computed custom property value that can be used when creating target groups.

    This method is used when you wish to supply a block of code that will be evaluated on foreground event or when either ROX.sync() , ROX.setup(withKey:) is called.

    Declaration

    Swift

    public static func setCustomProperty(key: String, value: @escaping () -> Double)

    Parameters

    key

    The name of the custom property

    value

    a code block to returns the value of the custom property

  • Check if ROX is disabled.

    Declaration

    Swift

    public static func roxDisabled() -> Bool

    Return Value

    true if ROX is disabled (disabled from the server side).