Customizing the User Interface
Override a view controller
To override a view controller you need to do the following:
Create a subclass of the class you want to override. For example, if you wanted to override the
BLoginViewControlleryou would make a subclass:public class CustomLoginViewController: BLoginViewControllerRegister your subclass with the Chat SDK. After you have initialized the Chat SDK in your app delegate, add the following:
BChatSDK.ui()?.setLoginViewController(CustomLoginViewController)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.
Create a subclass of the class you want to override. For example, if you wanted to override the
BChatViewControlleryou would make a subclass:public class CustomChatViewController: BChatViewControllerRegister 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) })Now the Chat SDK will load your view controller rather than the standard one.
Last updated
Was this helpful?