Views
UIKit for iOS allows you to create customizable views and execute essential chat functions such as list channels, create channels, and chat in channels. Key functions are available through view controller. Each function corresponds to a single view controller that creates the UI views. As shown in the table below, a key function is composed of four main elements: view controller, view model, module, and component. Each view controller has a view model and a module, which is composed of several components, also referred to as module components.
List of views
Key function | ViewController | ViewModel | Module | Component |
---|---|---|---|---|
SBUGroupChannelListViewController | SBUGroupChannelListViewModel | SBUGroupChannelListModule | Header, List | |
SBUGroupChannelViewController | SBUGroupChannelViewModel | SBUGroupChannelModule | Header, List, Input | |
SBUOpenChannelViewController | SBUOpenChannelViewModel | SBUOpenChannelModule | Header, List, Input, Media | |
SBUCreateChannelViewController | SBUCreateChannelViewModel | SBUCreateChannelModule | Header, List | |
SBUInviteUserViewController | SBUInviteUserViewModel | SBUInviteUserModule | Header, List | |
SBURegisterOperatorViewController | SBURegisterOperatorViewModel | SBURegisterOperatorModule | Header, List | |
SBURegisterOperatorViewController | SBURegisterOperatorViewModel | SBURegisterOperatorModule | Header, List | |
SBUUserListViewController | SBUUserListViewModel | SBUUserListModule | Header, List | |
SBUUserListViewController | SBUUserListViewModel | SBUUserListModule | Header, List | |
SBUGroupChannelSettingsViewController | SBUGroupChannelSettingsViewModel | SBUGroupChannelSettingsModule | Header, List | |
SBUOpenChannelSettingsViewController | SBUOpenChannelSettingsViewModel | SBUOpenChannelSettingsModule | Header, List | |
SBUModerationsViewController | SBUModerationsViewModel | SBUModerationsModule | Header, List | |
SBUModerationsViewController | SBUModerationsViewModel | SBUModerationsModule | Header, List | |
SBUMessageSearchViewController | SBUMessageSearchViewModel | SBUMessageSearchModule | Header, List | |
SBUMessageThreadViewController | SBUMessageThreadViewModel | SBUMessageThreadModule | Header, List, Input |
Architecture
For each key function, a view controller exists. It's composed of module and view model, which are both needed to build a view and gather data from the Chat SDK. The following diagram explains the basic architecture of UIKit for iOS.
ViewController
Every key function in Sendbird UIKit is available through a view controller. You can call the methods of a module and its components in the view controller to allow users to interact with the UI of the view. When events occur in the module component, the view controller is notified through a delegate. The view controller can also send data needed to update the view to the module component through a data source.
Module
In every key function, a module exists and there are multiple components configured within the module. The view controller can use any of these components along with data from a view model to create a functional view.
Module component
A component, also referred to as module component, is the part of view controller that builds a view. It's written as a {MODULE_TYPE}.{COMPONENT_TYPE}
property in the code as every component belongs to a module. The component uses the configure
method to set up a view when the loadView()
method of the view controller is called.
Component delegate
The view controller can receive events that occur in a module component through a delegate.
Component DataSource
A data source is used to access objects, such as data needed to update the view or implement the module component, from a view controller.
ViewModel
The view model processes and requests data directly from Sendbird Chat SDK. It processes the data it gathers from Chat SDK so it can be used appropriately in UIKit. While view models and modules don't communicate with each other, the view controller acts as the intermediary. Through the view controller, they can call each other's functions and exchange data. Like module component, the view model also has a delegate that sends events to the view controller.