> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stringboot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Basic Usage

> Learn how to use Stringboot in your iOS app

***

Stringboot provides native integrations for both SwiftUI and UIKit.

## SwiftUI

### SBText

Use the `SBText` view to automatically display localized strings. It updates automatically when the language changes.

```swift theme={null}
import SwiftUI
import StringbootSDK

struct ContentView: View {
    var body: some View {
        VStack {
            // Basic usage
            SBText("welcome_message")
                .font(.title)

            // With explicit language (optional)
            SBText("description", lang: "es")
        }
    }
}
```

### Property Wrapper

Use `@StringbootString` to bind a string to a property.

```swift theme={null}
struct ContentView: View {
    @StringbootString("welcome_message") var welcomeText: String

    var body: some View {
        Text(welcomeText)
    }
}
```

## UIKit

### SBLabel

`SBLabel` is a `UILabel` subclass that automatically updates its text.

```swift theme={null}
import UIKit
import StringbootSDK

class ViewController: UIViewController {
    let titleLabel = SBLabel(key: "welcome_message")

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(titleLabel)
    }
}
```

### Extensions

You can also use extensions on standard UIKit components.

```swift theme={null}
let button = UIButton()
button.setStringbootTitle(key: "submit_btn", for: .normal)

let textField = UITextField()
textField.setStringbootPlaceholder(key: "email_placeholder")
```

## Manual Access

For non-UI logic, you can fetch strings asynchronously.

```swift theme={null}
Task {
    let text = await StringProvider.shared.get("error_message")
    print(text)
}
```

## Changing Language

To switch the language of the app:

<Tabs>
  <Tab title="SwiftUI">
    ```swift theme={null}
    @StateObject var languageManager = StringbootLanguageManager()

    Button("Switch to Spanish") {
        languageManager.setLanguage("es")
    }
    ```
  </Tab>

  <Tab title="UIKit">
    ```swift theme={null}
    StringbootLanguageNotifier.shared.changeLanguage(to: "es")
    ```
  </Tab>
</Tabs>

<Note>
  When you change the language using `StringbootLanguageManager` or `StringbootLanguageNotifier`, all `SBText` and `SBLabel` instances update automatically.
</Note>
