# Remote Config

{% hint style="info" %}
This feature is supported in iOS SDK 2.11.0 and above.
{% endhint %}

Remote Config is a feature that lets you replace values or properties managed in your application with parameter values defined in the Hackle Dashboard, enabling real-time control of application behavior and settings.

Navigate to the Remote Config screen in the Hackle Dashboard to configure parameters and set values according to user identification rules.

## remoteConfig

Calling the `remoteConfig()` method returns a `HackleRemoteConfig` instance containing the Remote Config information (configured parameters and rule information) for the user.

{% tabs %}
{% tab title="Swift" %}

```swift
// 원격 구성 정보 담은 인스턴스를 반환합니다.
let remoteConfig = hackleApp.remoteConfig()
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
// 원격 구성 정보 담은 인스턴스를 반환합니다.
HackleRemoteConfig *remoteConfig = [hackleApp remoteConfig];
```

{% endtab %}
{% endtabs %}

## Query Remote Config Parameters

* The `HackleRemoteConfig` instance returned by `remoteConfig()` contains all the parameter configuration set in Remote Config.
* Since parameters set on the Hackle Remote Config screen exist as key-value pairs, you can use the methods below to retrieve parameter values according to the configured parameter type.
* You can dynamically change rules and values on the Remote Config parameter settings screen.

{% hint style="warning" %}
Remove Remote Config-related code after archiving.

Once a Remote Config parameter is archived, you can no longer access its parameter information. After archiving a Remote Config parameter, you must clean up the related code.
{% endhint %}

### getString

* Returns a parameter value configured as STRING or JSON type.
* Returns the default value or the value set by the rule based on the state decision.

{% tabs %}
{% tab title="Swift" %}

```swift
let remoteConfig: HackleRemoteConfig = hackleClient.remoteConfig()

let strValue: String = remoteConfig.getString(forKey: "parameter_key_string_type", defaultValue: "defaultValue")
let jsonValue: String = remoteConfig.getString(forKey: "parameter_key_json_type", defaultValue: "defaultValue")
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
HackleRemoteConfig *remoteConfig = [[Hackle app] remoteConfig];

NSString *stringValue = [remoteConfig getStringForKey:@"string" defaultValue:@"defaultValue"];

NSString *jsonValue = [remoteConfig getStringForKey:@"parameter_key_json_type" defaultValue:@"defaultValue"];
```

{% endtab %}
{% endtabs %}

### getInt

* Returns a parameter value configured as Number type as an Int.
* Returns the default value or the value set by the rule based on the state decision.

{% tabs %}
{% tab title="Swift" %}

```swift
let remoteConfig: HackleRemoteConfig = hackleClient.remoteConfig()

let intValue: Int = remoteConfig.getInt(forKey: "parameter_key_number_type", defaultValue: 0)
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
HackleRemoteConfig *remoteConfig = [[Hackle app] remoteConfig];

int intValue = [remoteConfig getIntForKey:@"parameter_key_number_type" defaultValue:@0];
```

{% endtab %}
{% endtabs %}

### getDouble

* Returns a parameter value configured as Number type as a Double.
* Returns the default value or the value set by the rule based on the state decision.

{% tabs %}
{% tab title="Swift" %}

```swift
let remoteConfig: HackleRemoteConfig = hackleClient.remoteConfig()

let doubleValue: Double = remoteConfig.getDouble(forKey: "parameter_key_number_type", defaultValue: 0.0)
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
HackleRemoteConfig *remoteConfig = [[Hackle app] remoteConfig];

double doubleValue = [remoteConfig getDoubleForKey:@"parameter_key_number_type" defaultValue:0.0];
```

{% endtab %}
{% endtabs %}

### getBool

* Returns a parameter value configured as Boolean type.
* Returns the default value or the value set by the rule based on the state decision.

{% tabs %}
{% tab title="Swift" %}

```swift
let remoteConfig: HackleRemoteConfig = hackleClient.remoteConfig()

let boolValue: Bool = remoteConfig.getBool(forKey: "parameter_key_boolean_type", defaultValue: false)
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
HackleRemoteConfig *remoteConfig = [[Hackle app] remoteConfig];

bool boolValue = [remoteConfig getBoolForKey:@"parameter_key_boolean_type" defaultValue:false];
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hackle.io/en/development-guide/ios/ios-remote-config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
