> For the complete documentation index, see [llms.txt](https://docs.nubrick.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nubrick.app/reference/ios/remoteconfigvariant.md).

# RemoteConfigVariant

### 定義 <a href="#definition" id="definition"></a>

```swift
public final class RemoteConfigVariant {
    public let experimentId: String
    public let variantId: String

    public func get(_ key: String) -> String?
    public func getAsString(_ key: String) -> String?
    public func getAsBool(_ key: String) -> Bool?
    public func getAsInt(_ key: String) -> Int?
    public func getAsFloat(_ key: String) -> Float?
    public func getAsDouble(_ key: String) -> Double?
    public func getAsData(_ key: String) -> Data?

    @MainActor
    public func getAsView(
        _ key: String,
        arguments: NubrickArguments? = nil,
        onEvent: ((_ event: ComponentEvent) -> Void)? = nil
    ) -> some View

    @MainActor
    public func getAsView<V: View>(
        _ key: String,
        arguments: NubrickArguments? = nil,
        onEvent: ((_ event: ComponentEvent) -> Void)? = nil,
        @ViewBuilder content: (@escaping (_ phase: SwiftUIEmbeddingPhase) -> V)
    ) -> some View

    @MainActor
    public func getAsUIView(
        _ key: String,
        arguments: NubrickArguments? = nil,
        onEvent: ((_ event: ComponentEvent) -> Void)? = nil
    ) -> UIView?

    @MainActor
    public func getAsUIView(
        _ key: String,
        arguments: NubrickArguments? = nil,
        onEvent: ((_ event: ComponentEvent) -> Void)? = nil,
        content: @escaping (_ phase: UIKitEmbeddingPhase) -> UIView
    ) -> UIView?
}
```

### 基本取得 <a href="#get" id="get"></a>

```swift
let experimentId = configVariant.experimentId
let variantId = configVariant.variantId

let str = configVariant.getAsString("title")
let enabled = configVariant.getAsBool("is_enabled")
let count = configVariant.getAsInt("max_count")
```

### View として取得（SwiftUI） <a href="#swiftui" id="swiftui"></a>

```swift
configVariant.getAsView(
    "hero_component",
    arguments: ["item_id": itemId]
)
```

### UIView として取得（UIKit） <a href="#uikit" id="uikit"></a>

```swift
let view = configVariant.getAsUIView(
    "hero_component",
    arguments: ["item_id": itemId]
)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nubrick.app/reference/ios/remoteconfigvariant.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
