# iOS

The SDK needs to be initialized with some basic settings (such as the directory the SDK can use for data storage and logs), and with a `TokenSigner` that is provided by the host application. This must occur early in the lifecycle of the app.

```swift
import Common
​
 // Choose a directory that the SDK can access and will own.
let sdkDirectory = FileManager.default.urls(for: .documentDirectory, in:.userDomainMask).first!.appendingPathComponent("sdk", isDirectory: true)

// The AppTokenSigner is a stub for the TokenSigner implementation developed within the host application.
try! initialize(Directories(root: sdkDirectory), tokenSignerFactory: { AppTokenSigner() })
```

How to implement Token Signer see [here](https://sdk.ims.tech/security).

***WARNING:*** Failing to initialize the SDK before using its functionality will result in unexpected behaviour.


---

# 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://sdk.ims.tech/readme/other-platforms/react-native/initialize-the-sdk/ios.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.
