> 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

### 定義

```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?
}
```

### 基本取得

```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）

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

### UIView として取得（UIKit）

```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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
