ApptimizeVariable

@interface ApptimizeVariable : NSObject

This interface is used to create and retrieve dynamic variables.

The factory methods are used to create and register dynamic variables with the SDK. As they need to be declared prior to setting up an experiment, they should be called as early as possible during app execution, such as in didFinishLaunchingWithOptions.

All the factory methods return a reference to the created dynamic variable.

As dynamic variables are expected to be declared ahead of time during app startup, getters are provided to retrieve those dynamic variables at time of use.

  • Create a string dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableString *_Nullable)stringWithName:(NSString *_Nonnull)name
                                        andDefaultString:
                                            (NSString *_Nonnull)defaultString;

    Swift

    class func makeString(name: String, defaultString: String) -> ApptimizeVariableString?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultString

    The default NSString for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableString if no variable has been created before with this name. If an ApptimizeVariableString already exists with this name it returns the existing string variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a bool dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableBool *_Nullable)boolWithName:(NSString *_Nonnull)name
                                      andDefaultBool:(BOOL)defaultBool;

    Swift

    class func makeBool(name: String, defaultBool: Bool) -> ApptimizeVariableBool?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultBool

    The default BOOL for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableBool if no variable has been created before with this name. If an ApptimizeVariableBool already exists with this name it returns the existing bool variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a bool dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableBool *_Nullable)boolWithName:(NSString *_Nonnull)name
                                    andDefaultNumber:
                                        (NSNumber *_Nonnull)defaultNumber;

    Swift

    class func makeBool(name: String, defaultNumber: NSNumber) -> ApptimizeVariableBool?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultNumber

    The default NSNumber (containing a BOOL) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableBool if no variable has been created before with this name. If an ApptimizeVariableBool already exists with this name it returns the existing bool variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create an integer dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableInteger *_Nullable)integerWithName:(NSString *_Nonnull)name
                                         andDefaultInteger:
                                             (NSInteger)defaultInteger;

    Swift

    class func makeInteger(name: String, defaultInteger: Int) -> ApptimizeVariableInteger?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultInteger

    The default NSInteger for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableInteger if no variable has been created before with this name. If an ApptimizeVariableInteger already exists with this name it returns the existing integer variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create an integer dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableInteger *_Nullable)integerWithName:(NSString *_Nonnull)name
                                 andDefaultUnsignedInteger:
                                     (NSUInteger)defaultUnsignedInteger;

    Swift

    class func makeInteger(name: String, defaultUnsignedInteger: UInt) -> ApptimizeVariableInteger?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultUnsignedInteger

    The default NSUInteger for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableInteger if no variable has been created before with this name. If an ApptimizeVariableInteger already exists with this name it returns the existing integer variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create an integer dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableInteger *_Nullable)integerWithName:(NSString *_Nonnull)name
                                          andDefaultNumber:
                                              (NSNumber *_Nonnull)defaultNumber;

    Swift

    class func makeInteger(name: String, defaultNumber: NSNumber) -> ApptimizeVariableInteger?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultNumber

    The default NSNumber (containing an NSInteger or NSUInteger) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableInteger if no variable has been created before with this name. If an ApptimizeVariableInteger already exists with this name it returns the existing integer variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a double dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableDouble *_Nullable)doubleWithName:(NSString *_Nonnull)name
                                        andDefaultDouble:(double)defaultDouble;

    Swift

    class func makeDouble(name: String, defaultDouble: Double) -> ApptimizeVariableDouble?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultDouble

    The default double for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableDouble if no variable has been created before with this name. If an ApptimizeVariableDouble already exists with this name it returns the existing double variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a double dynamic variable with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableDouble *_Nullable)doubleWithName:(NSString *_Nonnull)name
                                        andDefaultNumber:
                                            (NSNumber *_Nonnull)defaultNumber;

    Swift

    class func makeDouble(name: String, defaultNumber: NSNumber) -> ApptimizeVariableDouble?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultNumber

    The default NSNumber (containing a double) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableDouble if no variable has been created before with this name. If an ApptimizeVariableDouble already exists with this name it returns the existing double variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an array containing strings with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSString *> *_Nullable)
        stringArrayWithName:(NSString *_Nonnull)name
            andDefaultArray:(NSArray<NSString *> *_Nonnull)defaultStringArray;

    Swift

    class func makeStringArray(name: String, defaultStringArray: [String]) -> ApptimizeVariableArray<NSString>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultStringArray

    The default NSArray (containing NSStrings) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableArray if no variable has been created before with this name. If an ApptimizeVariableArray containing strings already exists with this name it returns the existing string array variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an array containing bools with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSNumber *> *_Nullable)
        boolArrayWithName:(NSString *_Nonnull)name
          andDefaultArray:(NSArray<NSNumber *> *_Nonnull)defaultBoolArray;

    Swift

    class func makeBoolArray(name: String, defaultBoolArray: [NSNumber]) -> ApptimizeVariableArray<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultBoolArray

    The default NSArray (containing NSNumbers of BOOLs) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableArray if no variable has been created before with this name. If an ApptimizeVariableArray containing bools already exists with this name it returns the existing bool array variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an array containing integers with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSNumber *> *_Nullable)
        integerArrayWithName:(NSString *_Nonnull)name
             andDefaultArray:(NSArray<NSNumber *> *_Nonnull)defaultIntegerArray;

    Swift

    class func makeIntegerArray(name: String, defaultIntegerArray: [NSNumber]) -> ApptimizeVariableArray<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultIntegerArray

    The default NSArray (containing NSNumbers of integers) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableArray if no variable has been created before with this name. If an ApptimizeVariableArray containing integers already exists with this name it returns the existing integer array variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an array containing doubles with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSNumber *> *_Nullable)
        doubleArrayWithName:(NSString *_Nonnull)name
            andDefaultArray:(NSArray<NSNumber *> *_Nonnull)defaultDoubleArray;

    Swift

    class func makeDoubleArray(name: String, defaultDoubleArray: [NSNumber]) -> ApptimizeVariableArray<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultDoubleArray

    The default NSArray (containing NSNumbers of doubles) for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableArray if no variable has been created before with this name. If an ApptimizeVariableArray containing doubles already exists with this name it returns the existing double array variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an dictionary with key/value pairs of string/string with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSString *> *_Nullable)
        stringDictionaryWithName:(NSString *_Nonnull)name
            andDefaultDictionary:(NSDictionary<NSString *, NSString *> *_Nonnull)
                                     defaultStringDictionary;

    Swift

    class func makeStringDictionary(name: String, defaultStringDictionary: [String : String]) -> ApptimizeVariableDictionary<NSString>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultStringDictionary

    The default NSDictionary of NSStrings keyed with NSStrings for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableDictionary if no variable has been created before with this name. If an ApptimizeVariableDictionary containing strings already exists with this name it returns the existing string dictionary variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an dictionary with key/value pairs of string/bool with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSNumber *> *_Nullable)
        boolDictionaryWithName:(NSString *_Nonnull)name
          andDefaultDictionary:
              (NSDictionary<NSString *, NSNumber *> *_Nonnull)defaultBoolDictionary;

    Swift

    class func makeBoolDictionary(name: String, defaultBoolDictionary: [String : NSNumber]) -> ApptimizeVariableDictionary<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultBoolDictionary

    The default NSDictionary of NSNumbers (containing BOOLs) keyed with NSStrings for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableDictionary if no variable has been created before with this name. If an ApptimizeVariableDictionary containing bools already exists with this name it returns the existing bool dictionary variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an dictionary with key/value pairs of string/integer with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSNumber *> *_Nullable)
        integerDictionaryWithName:(NSString *_Nonnull)name
             andDefaultDictionary:(NSDictionary<NSString *, NSNumber *> *_Nonnull)
                                      defaultIntegerDictionary;

    Swift

    class func makeIntegerDictionary(name: String, defaultIntegerDictionary: [String : NSNumber]) -> ApptimizeVariableDictionary<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultIntegerDictionary

    The default NSDictionary of NSNumbers (containing integers) keyed with NSStrings for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableDictionary if no variable has been created before with this name. If an ApptimizeVariableDictionary containing integers already exists with this name it returns the existing integer dictionary variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Create a dynamic variable of an dictionary with key/value pairs of string/double with a specified name and default value.

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSNumber *> *_Nullable)
        doubleDictionaryWithName:(NSString *_Nonnull)name
            andDefaultDictionary:(NSDictionary<NSString *, NSNumber *> *_Nonnull)
                                     defaultDoubleDictionary;

    Swift

    class func makeDoubleDictionary(name: String, defaultDoubleDictionary: [String : NSNumber]) -> ApptimizeVariableDictionary<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to create.

    defaultDoubleDictionary

    The default NSDictionary of NSNumbers (containing doubles) keyed with NSStrings for this dynamic variable.

    Return Value

    Returns a new ApptimizeVariableDictionary if no variable has been created before with this name. If an ApptimizeVariableDictionary containing doubles already exists with this name it returns the existing double dictionary variable but does not update the default value.
    Returns nil if a variable of another type already exists with this name.

  • Retrieve a string dynamic variable that has already been declared.

    Declaration

    Objective-C

    + (ApptimizeVariableString *_Nullable)getStringForName:(NSString *_Nonnull)name;

    Swift

    class func getString(name: String) -> ApptimizeVariableString?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableString if one has already been created with the specified name.
    Returns nil if no such variable exists with this name.

  • Retrieve a bool dynamic variable that has already been declared.

    Declaration

    Objective-C

    + (ApptimizeVariableBool *_Nullable)getBoolForName:(NSString *_Nonnull)name;

    Swift

    class func getBool(name: String) -> ApptimizeVariableBool?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableBool if one has already been created with the specified name.
    Returns nil if no such variable exists with this name.

  • Retrieve an integer dynamic variable that has already been declared.

    Declaration

    Objective-C

    + (ApptimizeVariableInteger *_Nullable)getIntegerForName:
        (NSString *_Nonnull)name;

    Swift

    class func getInteger(name: String) -> ApptimizeVariableInteger?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableInteger if one has already been created with the specified name.
    Returns nil if no such variable exists with this name.

  • Retrieve a double dynamic variable that has already been declared.

    Declaration

    Objective-C

    + (ApptimizeVariableDouble *_Nullable)getDoubleForName:(NSString *_Nonnull)name;

    Swift

    class func getDouble(name: String) -> ApptimizeVariableDouble?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableDouble if one has already been created with the specified name.
    Returns nil if no such variable exists with this name.

  • Retrieve a string array dynamic variable that has already been declared.

    See

    +[ApptimizeVariable stringArrayWithName:andDefaultStringArray:]

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSString *> *_Nullable)getStringArrayForName:
        (NSString *_Nonnull)name;

    Swift

    class func getStringArray(name: String) -> ApptimizeVariableArray<NSString>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableArray if one has already been created with the specified name which contains strings.
    Returns nil if no such variable exists with this name.

  • Retrieve a bool array dynamic variable that has already been declared.

    See

    +[ApptimizeVariable boolArrayWithName:andDefaultBoolArray:]

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSNumber *> *_Nullable)getBoolArrayForName:
        (NSString *_Nonnull)name;

    Swift

    class func getBoolArray(name: String) -> ApptimizeVariableArray<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableArray if one has already been created with the specified name which contains bools.
    Returns nil if no such variable exists with this name.

  • Retrieve a integer array dynamic variable that has already been declared.

    See

    +[ApptimizeVariable integerArrayWithName:andDefaultIntegerArray:]

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSNumber *> *_Nullable)getIntegerArrayForName:
        (NSString *_Nonnull)name;

    Swift

    class func getIntegerArray(name: String) -> ApptimizeVariableArray<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableArray if one has already been created with the specified name which contains integers.
    Returns nil if no such variable exists with this name.

  • Retrieve a double array dynamic variable that has already been declared.

    See

    +[ApptimizeVariable doubleArrayWithName:andDefaultDoubleArray:]

    Declaration

    Objective-C

    + (ApptimizeVariableArray<NSNumber *> *_Nullable)getDoubleArrayForName:
        (NSString *_Nonnull)name;

    Swift

    class func getDoubleArray(name: String) -> ApptimizeVariableArray<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableArray if one has already been created with the specified name which contains doubles.
    Returns nil if no such variable exists with this name.

  • Retrieve a string dictionary dynamic variable that has already been declared.

    See

    +[ApptimizeVariable stringDictionaryWithName:andDefaultStringDictionary:]

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSString *> *_Nullable)
        getStringDictionaryForName:(NSString *_Nonnull)name;

    Swift

    class func getStringDictionary(name: String) -> ApptimizeVariableDictionary<NSString>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableDictionary if one has already been created with the specified name which contains strings.
    Returns nil if no such variable exists with this name.

  • Retrieve a bool dictionary dynamic variable that has already been declared.

    See

    +[ApptimizeVariable boolDictionaryWithName:andDefaultBoolDictionary:]

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSNumber *> *_Nullable)getBoolDictionaryForName:
        (NSString *_Nonnull)name;

    Swift

    class func getBoolDictionary(name: String) -> ApptimizeVariableDictionary<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableDictionary if one has already been created with the specified name which contains bools.
    Returns nil if no such variable exists with this name.

  • Retrieve an integer dictionary dynamic variable that has already been declared.

    See

    +[ApptimizeVariable integerDictionaryWithName:andDefaultIntegerDictionary:]

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSNumber *> *_Nullable)
        getIntegerDictionaryForName:(NSString *_Nonnull)name;

    Swift

    class func getIntegerDictionary(name: String) -> ApptimizeVariableDictionary<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableDictionary if one has already been created with the specified name which contains integers.
    Returns nil if no such variable exists with this name.

  • Retrieve a double dictionary dynamic variable that has already been declared.

    See

    +[ApptimizeVariable doubleDictionaryWithName:andDefaultDoubleDictionary:]

    Declaration

    Objective-C

    + (ApptimizeVariableDictionary<NSNumber *> *_Nullable)
        getDoubleDictionaryForName:(NSString *_Nonnull)name;

    Swift

    class func getDoubleDictionary(name: String) -> ApptimizeVariableDictionary<NSNumber>?

    Parameters

    name

    The name of the dynamic variable to retrieve.

    Return Value

    Returns an ApptimizeVariableDictionary if one has already been created with the specified name which contains doubles.
    Returns nil if no such variable exists with this name.