OptimizelyVariableKey Class Reference

Inherits from NSObject
Declared in OptimizelyVariableKey.h


This class defines a key that can be used to retrieve Optimizely live variables.

The recommended method of creating an OptimizelyVariableKey is through the appropriate macro:

OptimizelyVariableKeyForString for NSString variables

OptimizelyVariableKeyForColor for UIColor variables

OptimizelyVariableKeyForNumber for NSNumber variables

OptimizelyVariableKeyForPoint for CGPoint variables

OptimizelyVariableKeyForSize for CGSize variables

OptimizelyVariableKeyForRect for CGRect variables

OptimizelyVariableKeyForBool for BOOL variables

For example:

OptimizelyVariableKeyForString(myStringVariable, @“My default string”);

Defines an OptimizelyVariableKey called myStringVariable for an NSString variable with a default value of @“My default string”.

You may then read your variable as:

NSString *myString = [Optimizely stringForKey:myStringVariable];

Warning: Optimizely number variables are limited in size and precision to those of a double.


A unique name for this OptimizelyVariableKey

@property (readonly) NSString *key

Declared In



The value that will be returned if no active experiment involves this variable.

@property (readonly) id defaultValue

Declared In



The type of this key

@property (readonly) NSString *type

Declared In