The following information is for the latest SDK version (6.x). The CloudBees platform requires that your installed SDK version be at least 6.x. Please install the latest SDK by following the instructions in the platform UI or in the SDK installation documentation. Any updates to version 6.x are noted in the platform changelog. |
Once the SDK is installed and initialized, any feature flags declared in your code are automatically registered in the platform.
Class ROX
The ROX
class provides the interface for managing feature flags in your iOS or tvOS application. It enables you to register containers, set up the SDK using an environment-specific key, and define custom properties for targeting users. Feature flags are evaluated at runtime based on platform configuration.
Setup
Initializes the SDK and connects to the CloudBees platform.
[ROX setupWithKey:@"<YOUR-SDK-KEY>"];
Parameter | Type | Description |
---|---|---|
|
|
The SDK key provided in the platform UI for your environment. |
This method does not return a value |
Shutdown
Call the shutdown method to stop the SDK and clean up resources. If not explicitly shut down, the SDK remains active until the application exits.
Register
Register a container that defines your feature flags with the CloudBees Feature Management system.
[ROX register:[[Flags alloc] init]]; [ROX register:@"myNamespace" container:[[Flags alloc] init]];
Parameter | Type | Description |
---|---|---|
container |
|
A class that defines and contains your feature flags. Call register: only once for a given container class. |
namespace |
|
A string that serves as a prefix for the feature flags inside the container. A namespace can only be registered once. Using the same namespace twice throws an exception. |
|
Define a container
Your container class must inherit from ROXBaseContainer
. Define flags using supported flag types.
@interface Flags : ROXBaseContainer @property (nonatomic) ROXFlag* enableTutorial; @property (nonatomic) ROXString* titleColors; @end
Supported flag types
The SDK provides several classes for defining feature flags, depending on the data type you want to evaluate. Use these classes to declare flags in your code and access their values based on platform configuration and targeting rules.
Methods
Method | Description |
---|---|
|
Executes a block when the flag is enabled. |
|
Executes a block when the flag is disabled. |
|
Returns |
Class ROXString
Represents a feature flag that returns one of several string values.
self.titleColors = [[ROXString alloc] initWithDefault:@"White" variations:@[@"Blue", @"Green", @"Yellow"]];
Custom properties
Use custom properties to support advanced targeting. You can define static or computed (dynamic) values.
setCustomBooleanProperty
Set a static Boolean custom property.
[ROX setCustomBooleanProperty:@"isTester" value:YES];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
Static Boolean value. |
setCustomComputedBooleanProperty
Set a computed Boolean custom property using a block.
[ROX setCustomComputedBooleanProperty:@"isTester" with:^BOOL(id context) { return [context[@"role"] isEqualToString:@"tester"]; }];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
A block that returns a |
setCustomStringProperty
Set a static String custom property.
[ROX setCustomStringProperty:@"userType" value:@"beta"];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
Static String value. |
setCustomComputedStringProperty
Set a computed String custom property using a block.
[ROX setCustomComputedStringProperty:@"userType" with:^NSString*(id context) { return context[@"userType"]; }];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
A block that returns a |
setCustomIntegerProperty
Set a static Integer custom property.
[ROX setCustomIntegerProperty:@"userAge" value:25];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
Static Integer value. |
setCustomComputedIntegerProperty
Set a computed Integer custom property using a block.
[ROX setCustomComputedIntegerProperty:@"userAge" with:^NSInteger(id context) { return [context[@"age"] integerValue]; }];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
A block that returns an |
setCustomDoubleProperty
Set a static Double custom property.
[ROX setCustomDoubleProperty:@"userScore" value:99.5];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
Static Double value. |
setCustomComputedDoubleProperty
Set a computed Double custom property using a block.
[ROX setCustomComputedDoubleProperty:@"userScore" with:^double(id context) { return [context[@"score"] doubleValue]; }];
Parameter | Type | Description |
---|---|---|
|
|
Name of the custom property. |
|
|
A block that returns a |
Real time updates (SSE)
The SDK supports real-time feature flag updates using Server-Sent Events (SSE) from the following endpoint:
https://sdk-notification-service.cloudbees.io/sse
This URL allows the SDK to receive real-time configuration updates. For example, when a flag state changes, the update is pushed instantly to the SDK rather than waiting for polling.
Ensure this URL is allowlisted in your network configuration.