# Customizing the User Interface

#### Override a view controller

To override a view controller you need to do the following:

1. Create a subclass of the class you want to override. For example, if you wanted to override the `BLoginViewController` you would make a subclass:

   ```
   public class CustomLoginViewController: BLoginViewController
   ```
2. Register your subclass with the Chat SDK. After you have initialized the Chat SDK in your app delegate, add the following:

   ```
   BChatSDK.ui()?.setLoginViewController(CustomLoginViewController)
   ```
3. Now the Chat SDK will load your view controller rather than the standard one.

#### Overriding using a provider

In some cases, it's necessary for the view controller to be given a parameter when it's created. An example of this is with the chat view controller which needs to be given the thread to load. In this case, rather than registering the view controller directly, we register a provider.

1. Create a subclass of the class you want to override. For example, if you wanted to override the `BChatViewController` you would make a subclass:

   ```
   public class CustomChatViewController: BChatViewController
   ```
2. Register your provider with the Chat SDK. After you have initialized the Chat SDK in your app delegate, add the following:

   ```
    BChatSDK.ui()?.setChatViewController({ (thread: PThread?) -> BChatViewController? in
        return CustomChatViewController.init(thread: thread)
    })
   ```
3. Now the Chat SDK will load your view controller rather than the standard one.


---

# 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://chat-sdk.gitbook.io/ios/api/customizing-the-user-interface.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.
