Group channel
This page explains key functions of group channels in Sendbird UIKit for iOS, consisting of how to list channels, chat in a channel, configure channel settings, create a channel, invite users, and list channel members.
List channels
The SBUChannelListViewController is a class that is used to get a channel list view. When there is no connection between the client app and Sendbird server, this class is automatically called and reconnects the two. Once the client app is connected to Sendbird server, the class is called and a list of channels in the client app is displayed. In addition the class handles core features including pagination and real-time updates. All chat services built with Sendbird UIKit begin from the channel list.
How to use
In the UIKit, you can build a channel list-based chat service without the need for complicated implementation through the SBUChannelListViewController class. Use the following code to list channels in a view.
Note: You can initialize the
SBUChannelListViewControllerby setting theSBDChannelListQueryobject. Otherwise, the default values are used.
Note: At this point, you can confirm if the service is working by running your app.
Components and features
The components of the SBUChannelListViewController class include Header and List. The List is an area where the UITableView shows channel information using the SBUChannelCell. The features of the SBUChannelListViewController include:
List of features
| Feature | Description |
|---|---|
Enter channel | Enters a channel by selecting a channel cell on the list. |
Notifications on and off | Turns push notifications on and off by swiping a cell. |
Create channel | Creates a channel by using the channel type selector if the application uses a Supergroup channel feature. If not, go directly to the create channel page. |
Channel type selector | Allows a user to select a channel type to create. |
Leave channel | Leaves a channel by swiping a cell. |
Back and dismiss | Triggers a pop view and dismisses an action. |
Edit components
The following table lists a set of customizable properties and methods of the SBUChannelListViewController class.
List of properties
| Property name | Type | Description |
|---|---|---|
channelList |
| An object that contains a list of channels which are synchronized with the server. |
channelListQuery |
| A query that retrieves a list of channels and change logs of channels. |
List of methods
| Method | Description |
|---|---|
register(channelCell:nib:) | Access level: public |
register(customCell:nib:) | Access level: public |
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
showChannel(channelUrl:) | Access level: open |
showCreateChannelTypeSelector() | Access level: open |
showCreateChannel(type:) | Access level: open (Default: |
changePushTriggerOption(option:channel:completionHandler:) | Access level: public |
leaveChannel(channel:) | Access level: public |
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
ChannelList_Header_Title | The title of the |
ChannelList_Last_File_Message | A text displayed when the last message in a channel is a |
Note : A set of common strings isn't included in the list. See the
StringSetsection in the Common resources menu.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons. The iconSet includes:
iconActionLeaveLight,iconActionNotificationOffLight,iconActionNotificationOnLight,iconCreate,iconMute
Note : A set of common icons is not included in the list. See the
IconSetsection in the Common resources menu.
Customize the class
You can subclass and customize the SBDChannelListviewController to enhance the user experience of your app. The overridable methods include:
viewLifeCycle,SBDConnectionDelegate
Note : We recommend you should fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Channel type selector
Channel type selector exposes all the available channel types a user can create. If the Supergroup channel feature is turned on for the app, this selector will display channel two types: Group and Supergroup.
Use the isSupportSuperGroupChannel() method of the SBUAvailable class to see what channel types are supported for your application.
View customization
In order to customize the Channel type selector, you need to implement a custom view through the SBUCreateChannelTypeSelectorProtocol and SBUCreateChannelTypeSelectorDelegate classes first.
If you implement the view through the SBUCreateChannelTypeSelectorProtocol class, the SBUChannelListViewController calls the show() and dismiss() actions if necessary. Another way to implement the custom view is to override the showCreateChannelTypeSelector() method.
Once implemented, set the custom view to the createChannelTypeSelector in the SBUChannelListViewController.
- SBUCreateChannelTypeSelectorProtocol
The following table lists properties of the SBUCreateChannelTypeSelectorProtocol class.
| Property name | Description |
|---|---|
show() | Shows a selector view. |
dismiss() | Makes a selector view disappear. |
Action customization
You can customize an action by overriding the methods of the SBUCreateChannelTypeSelectorDelegate class in the SBUChannelListViewController class.
Note : The
didSelectCreateGroupChannel(),didSelectCreateSuperGroupChannel()methods of theSBUCreateChannelTypeSelectorDelegateclass calls theshowCreateChannel(type:)method. But if you have customized theSBUCreateChannelViewControllerclass, you can implement the custom action by overriding theshowCreateChannel(type:)method.
- SBUCreateChannelTypeSelectorDelegate
The following table lists properties of the SBUCreateChannelTypeSelectorDelegate class.
| Property name | Description |
|---|---|
didSelectCloseSelector() | Notifies the |
didSelectCreateGroupChannel() | Notifies the |
didSelectCreateSuperGroupChannel() | Notifies the |
Theme
The SBUChannelListViewController class uses two of the SBUTheme, which are the SBUChannelCellTheme and the SBUChannelListTheme. The SBUChannelCellTheme is used for the SBUChannelCell while the SBUChannelListTheme is used for all elements of the SBUChannelListViewController but the SBUChannelCell. Theme properties cannot be accessed directly and should be customized only through the SBUTheme. Then you should call the setupStyle() afterwards in order to apply any changes you make through the SBUTheme.
Set a custom theme
You can customize themes through the SBUTheme.setChannelList as below:
Note : You should call the
setupStyle()method to update your user interface.
Edit theme elements
Themes can be customized through the SBUTheme. It is recommended to change the themes prior to viewController initialization. The following code shows how to customize the elements of the theme.
Note : You should call the
setupStyle()method to update your user interface.
- SBUChannelListTheme
The SBUChannelListTheme object has properties used in the SBUChannelListViewController.
| Category | Property | Description |
|---|---|---|
Navigation bar | leftBarButtonTintColor | The tint color of the button at the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button at the right side of the navigation bar. |
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Status bar | statusBarStyle | The style of the status bar. |
View | backgroundColor | The background color of the channel list view. |
Table view | alertBackgroundColor | The background color of the alert. |
Table view | notificationOnBackgroundColor | The background color of the notification-on. |
Table view | notificationOnTintColor | The tint color of the notification-on. |
Table view | notificationOffBackgroundColor | The background color of the notification-off. |
Table view | notificationOffTintColor | The tint color of the notification-off. |
Table view | leaveBackgroundColor | The background color of the leave channel button. |
Table view | leaveTintColor | The tint color of the leave channel button. |
- SBUChannelCellTheme
The SBUChannelCellTheme object has properties used in the SBUChannelCell.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the cell. |
View | separatorLineColor | The color of the separator line. |
Title | titleFont | The font of the title element. |
Title | titleTextColor | The text color of the title element. |
Member count | memberCountFont | The font of the member count element. |
Member count | memberCountTextColor | The text color of the member count element. |
Last updated time | lastUpdatedTimeFont | The font of the last-updated time element. |
Last udated time | lastUpdatedTimeTextColor | The text color of the last-updated time element. |
Message | messageFont | The font of the message element. |
Message | messageTextColor | The text color of the message element. |
Unread count | unreadCountBackgroundColor | The background color of the unread message count element. |
Unread count | unreadCountFont | The font of the unread message count element. |
Unread count | unreadCountTextColor | The text color of the unread message count element. |
Channel State | freezeStateTintColor | The tint color of the freeze state mark element. |
Create a channel
In the UIKit, you can create a channel through the SBUCreateChannelViewController class with a group of selected users. The class also affects the SBUUserCell class which shows a user list and the user list is organized and displayed according to the setting of pagination. If you don’t have a separate list of users you wish to add to your application, all the users who are using your chat service are displayed in the user list by default.
By default the name and cover image of the channel are also given when the channel is created. The channel will be the list of nickname of channel members, and its cover image will be created using the profileimage of those members.
Note : Simply setting your chat service to be based on the channel list can seamlessly lead users to the Create channel view. Once a new channel is successfully created, a channel view will appear immediately for the user. If the
channel typeis set during initialization, a new channel is created as the selected type. However, if you create a channel through thecreateChannel(params:)method with parameters, the channel type information must be set in the parameter again. And, the user who creates a new channel becomes an operator of the channel by default.
How to use
You can create a channel by simply calling the SBUCreateChannelViewController class. Use the following code to create a new channel.
Using your own user list
You can also create a channel with a list of users you specifically selected. To do so, an array of SBUUser objects should be injected.
Note : You can convert the
SBDUserobjects from the Chat SDK to theSBUUseras they are compatible.
Use the following code to create a channel with a preset list of users.
Components and features
The SBUCreateChannelViewController is composed of a list of users who can be invited to the newly created channel.
Edit components
The following table lists the customizable properties and methods of the SBUCreateChannelViewController class.
List of methods
| Method | Description |
|---|---|
register(userCell:nib:) | Access level: public |
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
createChannel(userIds:) | Access level: public |
createChannel(params:) | Access level: public |
loadNextUserList(reset:users:) | Access level: public |
nextUserList() | Access level: open |
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
CreateChannel_Header_Title | The title of the |
CreateChannel_Create (count) | A text for the Create button on the navigation bar. |
Note : A set of common string is not included in the list. See the Common resources page's
StringSetsection.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons.
Note : A set of common icons is not included in the list. See the Common resources page's
IconSetsection.
Customize the class
You can subclass and customize the SBUCreateChannelViewController to enhance the user experience of your app. The overridable methods include:
viewLifeCycle,loadNextUserList()
Note : We recommend you should fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Set a custom theme
You can customize themes through the SBUTheme.setUserList as below:
Note : You should call the
setupStyle()method to update your user interface.
Edit theme elements
Themes can be customized through the SBUTheme. It is recommended to change the themes prior to the viewController initialization. The following code shows how to customize the elements of the theme.
- SBUUserListTheme
The SBUUserListTheme object has properties used in the following classes: SBUCreateChannelViewController, SBUInviteUserViewController and SBUMemberListViewController.
List of properties
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Navigation bar | leftBarButtonTintColor | The tint color of the button at the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button at the right side of the navigation bar. |
Navigation bar | rightBarButtonSelectedTintColor | The tint color to apply to the button at the right side of the navigation bar when selected. |
Status bar | statusBarStyle | The style of the status bar. |
Cell | cellTextFont | The text font of the cell. |
- SBUUserCellTheme
The SBUUserCellTheme object has properties used in the SBUUserCell.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the view. |
View | separateColor | The color of the separator. |
Check box | checkboxOnColor | The color to apply to a checkbox element when checked. |
Check box | checkboxOffColor | The color to apply to a checkbox element when unchecked. |
User | userNameTextColor | The text color of the user name element. |
User | userNameFont | The text font of the user name element. |
User | userPlaceholderBackgroundColor | The background color of the user name element's placeholder. |
User | userPlaceholderTintColor | The tint color of the user name element's placeholder. |
Chat in a channel
UIKit allows 1-on-1 and 1-to-N chats through private and public group channels. It also provides a Supergroup channel to facilitate a more stable chat environment for a larger number of users. They can be easily managed without the need for complex implementation.
UIKit supports plain text messages, file messages, and media content such as photos and videos. Once sent, those messages are grouped by time and date, displaying the time by minute. In addition, all messages in open channels are cached using memory, and messages that failed to be sent are only kept within the active channel object.
Note : Simply setting your chat service to be based on the channel list can seamlessly lead users to the Channel view. As for the function that groups messages based on their sent time can be turned on and off through the
UsingMessageGroupingproperty in theSBUGlobalsclass.
How to enable chat through SBUChannelViewController
All chat services built with Sendbird UIKit for iOS begin from the channel list. You can build a channel-based chat service by calling the SBUChannelViewController class. It uses the SBUAdminMessageCell, SBUUserMessageCell and SBUFileMessageCell to display information.
The SBUChannelViewController class also is in charge of an auto connection to Sendbird server and internal logics to handle core features of UIKit such as pagination and real-time updates.
Note: You can initialize the
SBUChannelViewControllerby setting theChannelUrlorSBDGroupChannelobject. And, if you have ownSBDMessageListParamsobject, please set them together. If not set, it is used as the default value.
Use the following code to enable users to chat in a channel view.
Global usage
You can directly take a user to a specific channel from notifications through the SBUMain.moveToChannel(channelUrl:) method. This method is used to find the destination channel to put the user in or even to create one if there is no applicable channel.
Components and features
The components of the SBUChannelViewController class include Header, List, and messageInput. The List is an area where the UITableView displays messages in the channel using the SBUUserMessageCell, SBUFileMessageCell, and SBUAdminMessageCell.
The features of the SBUChannelViewController class include:
List of features
| Feature | Description |
|---|---|
Message input view | Allows users to send messages, image/video or files. |
New message information | Displays a notification when a new message arrives. |
Last seen time | Displays a member’s last seen time. This is only available for 1-on-1 channels. |
Send status | Displays message send status such as success, failed, and sending. |
Delivery receipt status | Displays message delivery receipt status. |
Read receipt status | Displays message receipt status. |
Message copying | Allows users to copy a message. (text only) |
Message editing | Allows users to edit a message. (own message only) |
Message deleting | Allows users to delete a message. (own message only) |
Retry send message | Allows users to resend a failed message. |
Channel settings menu | Navigates to the Setting view from the |
Back and dismiss | Returns to the previous view from the |
State banner | Displays the status of the channel in the top banner. Currently, the banner can only display the |
Edit components
The following table lists a set of customizable properties and methods of the SBUChannelViewController class.
List of properties
| Property name | Type | Description |
|---|---|---|
channel | SBDGroupChannel | An object that represents the channel. |
channelName | String | The customized title of the channel. |
messageList | SBDBaseMessage | An object that contains a list of messages which are synchronized with the server. |
|
| (Deprecated) |
messageInputView | SBUMessageInputView | The customized message input view. |
newMessageInfoView | SBUNewMessageInfo | The customized new message info view. |
messageListParams | SBDMessageListParams | A set of parameters that retrieves a list and change logs of the messages. |
startingPoint | Int64 | A start point of the message list which can be set through the |
useRightBarButtonItem | Bool | A flag that determines whether to use the right bar button item or not. |
highlightInfo | SBUHighlightMessageInfo | A |
List of methods
| Method | Description |
|---|---|
register(adminMessageCell:nib:) | Access level: public |
register(fileMessageCell:nib:) | Access level: public |
register(userMessageCell:nib:) | Access level: public |
register(customMessageCell:nib:) | Access level: public |
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
showChannelSettings() | Access level: open |
setTapGestureHandler(_ cell:message:) | Access level: open |
setLongTapGestureHandler(_ cell:message:indexPath:) | Access level: open |
sendUserMessage(text:) | Access level: public |
sendUserMessage(messageParams:) | Access level: public |
sendFileMessage(fileData:fileName:mimeType:) | Access level: public |
sendFileMessage(messageParams:) | Access level: public |
resendMessage(failedMessage:) | Access level: public |
updateUserMessage(message:text:) | Access level: public |
updateUserMessage(message:messageParams:) | Access level: public |
deleteMessage(message:) | Access level: public |
Note : To customize the
messageInputViewornewMessageInfoView, you should subclass theSBUMessageInputVieworSBUNewMessageInfoclass, respectively. Also, if theMessageInputViewindicates that the channel is frozen or the member is muted in the channel, the channel state can be changed through thesetFrozenModeState(_ isFrozen:)orsetMutedModeState(_ isMuted:)method of theSBUMessageInputView.
In the case where both Frozen and Muted states coexist in a channel, only the Frozen state will be displayed in the view.
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
Channel_Name_Default | The default channel name. |
Channel_New_Message (count) | A text for new message popup. |
Channel_New_Message_File (%@) | A text for file message upload completion. |
Channel_Success_Download_file | A text for file save completion. |
Channel_Header_LastSeen (timestamp) | A text for a member’s last seen time. |
Channel_Header_Typing (typingMembers) | A text for a member’s typing status. |
MessageInput_Text_Placeholder | A placeholder for a message input box. |
MessageInput_Text_Unavailable | A placeholder to indicate that a message can't be entered in the input box when the channel is frozen. |
MessageInput_Text_Muted | A placeholder to indicate that a message can't be entered in the input box when the user is blocked. |
Message_Edited | A text for message edit pop-up. |
Message_System | A text for system message type. |
Message_Unknown_Title | A title for an unknown message. |
Message_Unknown_Description | A description for an unknown message. |
Channel_State_Banner_Frozen | A text to be displayed in the state banner for a frozen channel. |
Note : A set of common string is not included in the list. See the
StringSetsection in the Common resources menu.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons. The iconSet includes:
iconCopy,iconEdit,iconInfo,iconNewMessage,iconAdd,iconSend,iconDelivered,iconErrorFilled,iconRead,iconSent,iconSpinnerSmall,iconFileAudio,iconFileDocument,iconGif,iconPlay
Note : A set of common icons is not included in the list. See the
IconSetsection in the Common resources menu.
Customize the class
You can subclass and customize the SBUChannelViewController to enhance the user experience of your app. The overridable methods include:
viewLifeCycle,SBUMessageInputViewDelegate,SBUFileViewerDelegate,SBDConnectionDelegate
If you wish to create and implement a custom message cell, you must inherit the SBUBaseMessageCell class. To register your custom message cell to be shown on the List component of the channel view, use the register(customMessageCell:nib:) function.
You can also change a cell's Identifier by overriding the generateCellIdentifier function. By default, the cell's Identifier takes on the name of the class.
Note : We recommend you should fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Theme
To display messages, the SBUChannelViewController uses two views and three themes. Two views include the SBUBaseMessageCell and the SBUMessageInputView, and three themes are the SBUChannelTheme, SBUMessageCellTheme, and SBUMessageInputTheme in the SBUTheme.
The overall elements of the SBUChannelViewController are managed through the SBUChannelTheme while the SBUBaseMessageCell uses the SBUMessageCellTheme to show messages in the view and the SBUMessageInputView uses the SBUMessageInputThemefor the design of the message input box in the view.
All three themes mentioned above can be customized through the SBUTheme but you should call the setupStyle() afterwards in order to apply any changes you made.
Set a custom theme
You can customize the channel theme through the SBUTheme.setChannel as below:
Note : You should call the
setupStyle()method afterwards in order to apply any changes you made.
Edit theme elements
Themes can be customized through the SBUTheme. It is recommended to change the themes prior to viewController initialization. The following code shows how to customize the elements of the theme.
Note : You should call the
setupStyle()method afterwards in order to apply any changes you made.
- SBUChannelTheme
The SBUChannelTheme object has properties used in the SBUChannelViewController.
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Navigation bar | leftBarButtonTintColor | The tint color of the button at the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button at the right side of the navigation bar. |
Status bar | statusBarStyle | The style of the status bar. |
View | backgroundColor | The background color of the channel view. |
Alert | removeItemColor | The color of the item remove alert. |
Alert | cancelItemColor | The color of the item cancel alert. |
Alert | alertRemoveColor | The color of the remove action's button. |
Alert | alertCancelColor | The color of the cancel action's button. |
Menu | menuTextColor | The text color of the menu. |
State banner | channelStateBannerFont | The text font of the state banner. |
State banner | channelStateBannerTextColor | The text color of the state banner. |
State banner | channelStateBannerBackgroundColor | The background color of the state banner. |
- SBUMessageInputTheme
The SBUMessageInputTheme object has properties used in the SBUChannelViewController.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the message input view. |
Text field | textFieldBackgroundColor | The background color of the input field. |
Text field | textFieldPlaceholderColor | The color of the placeholder in the input field. |
Text field | textFieldPlaceholderFont | The font of the placeholder in the input field. |
Text field | textFieldDisabledColor | The color of the placeholder to indicate that text can't be entered in the input field. |
Text field | textFieldTintColor | The tint color of the text in the input field. |
Text field | textFieldTextColor | The color of the text in the input field. |
Text field | textFieldBorderColor | The border color of the input field. |
Button | buttonTintColor | The tint color of the add, cancel, and save buttons. |
Button | buttonDisabledTintColor | The tint color of the add button when entering text is not available. |
Button | cancelButtonFont | The font of the cancel button. |
Button | saveButtonFont | The font of the save button. |
Button | saveButtonTextColor | The color of the text on the save button. |
- SBUMessageCellTheme
The SBUMessageCellTheme object has properties used in the SBUChannelViewController.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the cell. |
View | leftBackgroundColor | The background color of the left side of the cell. |
View | rightBackgroundColor | The background color of the right side of the cell. |
View | leftPressedBackgroundColor | The background color to apply to the button at the left side when pressed. |
View | rightPressedBackgroundColor | The background color to apply to the button at the right side when pressed. |
Date label | dateFont | The font of the date element. |
Date label | dateTextColor | The text color of the date element. |
Date label | dateBackgroundColor | The background color of the date element. |
User | userNameFont | The font of the user name. |
User | userNameTextColor | The text color of the user name element. |
User | userPlaceholderBackgroundColor | The background color of the user name element's placeholder. |
User | userPlaceholderTintColor | The tint color of the user name element's placeholder. |
Title label | timeFont | The font of the time element. |
Title label | timeTextColor | The text color of the time element. |
Message state | pendingStateColor | The color to apply when the state of a message is pending. |
Message state | failedStateColor | The color to apply when the state of a message is failed. |
Message state | succeededStateColor | The color to apply when the state of a message is succeeded. |
Message state | readReceiptStateColor | The color of the read receipt state element. |
Message state | deliveryReceiptStateColor | The color of the delivery receipt state element. |
User message | userMessageFont | The font to apply to a user message. |
User message | userMessageLeftTextColor | The text color to apply to a user message displayed on the left of the channel view. |
User message | userMessageLeftEditTextColor | The text color to indicate edited a user message displayed on the left of the channel view. |
User message | userMessageRightTextColor | The text color to apply to a user message displayed on the right of the channel view. |
User message | userMessageRightEditTextColor | The text color to indicate an edited user message displayed on the right of the channel view. |
File message | fileIconBackgroundColor | The background color of the file icon |
File message | fileIconColor | The color of the file icon. |
File message | fileMessageNameFont | The text font of the file message name element. |
File message | fileMessageLeftTextColor | The text color of the left side of a file message. |
File message | fileMessageRightTextColor | The text color of the right side of a file message. |
File message | fileMessagePlaceholderColor | The text color of a file message's placeholder. |
Admin message | adminMessageFont | The text font of an admin message. |
Admin message | adminMessageFont | The text color of an admin message. |
Unknown message | unknownMessageDescFont | The text font of an unknown message. |
Unknown message | unknownMessageDescTextColor | The text color of an unknown message. |
Invite users or promote users to operators
In the UIKit, you can invite users to a specific group channel or promote a user to an operator of a specific channel according to the type set by the SBUInviteUserViewController class. The ViewController uses the SBUUserCell class to display a list of members except the ones who are already in the channel. The same SBUUserCell class is also used when inviting a user or appoint a user as an operator of a specific group channel.
Unless you have a separate list of users you specifically selected, all users who are registered to your service appear in the user list by default.
Note : Simply setting your chat service to be based on either the channel list, channels, channel settings or member list can seamlessly lead users to the Invite users view. For the view, you can set
inviteUserTypeto use the desired function amonguser invitationandpromote to operatorthen initializing theSBUInviteUserViewControllerclass.
How to use
Invite users to a group channel with a simple implementation through the SBUInviteUserViewController class.
Note : You can initialize the
SBUInviteUserViewControllerclass by setting theChannelUrlorSBDGroupChannelobject.
Use the following code to invite a user to a channel.
Using your own user list
You can also invite a list of users you specifically selected. To do so, an array of SBUUser objects should be injected.
Note : You can convert the
SBDUserobjects from the Chat SDK to theSBUUseras they are compatible.
Use the following code to invite a list of users you specifically selected to a channel.
Components and features
The SBUInviteUserViewController is composed of a list of users who can be invited to existing channels.
Edit components
The following table lists the customizable properties and methods of the SBUInviteUserViewController class.
List of methods
| Method | Description |
|---|---|
register(userCell:nib:) | Access level: public |
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
inviteUsers() | Access level: public |
inviteUsers(userIds:) | Access level: public |
promoteToOperators() | Access level: public |
promoteToOperators(memberIds:) | Access level: public |
loadNextUserList(reset:users:) | Access level: public |
nextUserList() | Access level: open |
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
InviteChannel_Header_Title | The title of the |
InviteChannel_Header_Select_Members | A text for Select members. |
InviteChannel_Invite(%d) | A text for the Invite button in the navigation bar. |
InviteChannel_Add(%d) | A text for the Add button in the navigation bar. |
Note : A set of common strings isn't included in the list. See the
StringSetsection in the Common resources menu.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons.
Note : A set of common icons is not included in the list. See the
IconSetsection in the Common resources menu.
Customize the class
You can subclass and customize the SBUInviteUserViewController to enhance the user experience of your app. The overridable methods include:
viewLifeCycle,loadNextUserList()
Note : We recommend you should fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Set a custom theme
You can customize themes through the SBUTheme.setUserList as below:
Note : You should call the
setupStyle()method to update your user interface.
Edit theme elements
Themes can be customized through the SBUTheme class. It is recommended to change the themes prior to the viewController initialization. The following code shows how to customize the elements of the theme.
Note : You should call the
setupStyle()method to update your user interface.
- SBUUserListTheme
The SBUUserListTheme object has properties used in the following classes: SBUCreateChannelViewController, SBUInviteUserViewController and SBUMemberListViewController.
List of properties
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Navigation bar | leftBarButtonTintColor | The tint color of the button at the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button at the right side of the navigation bar. |
Navigation bar | rightBarButtonSelectedTintColor | The tint color to apply to the button at the right side of the navigation bar when selected. |
Cell | cellTextFont | The text font of the cell. |
- SBUUserCellTheme
The SBUUserCellTheme object has properties used in the SBUUserCell.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the view. |
View | separateColor | The color of the separator. |
Check box | checkboxOnColor | The color to apply to a checkbox element when checked. |
Check box | checkboxOffColor | The color to apply to a checkbox element when unchecked. |
User | userNameTextColor | The text color of the user name element. |
User | userNameFont | The font of the user name element. |
List channel members
In UIKit, you can retrieve the list of members in a specific group channel through the SBUMemberListViewController class. This class displays a list of channel members, operators, muted members, and banned members using the SBUUserCell class.
Note : Simply setting your chat service to be based on either the channel list, channels, or channel settings can seamlessly lead users to the Member list view.
How to use
You can get the list of members in a specific channel by simply calling the SBUMemberListViewController class.
Note : You can initialize the
SBUMemberListViewControllerclass by setting aChannelUrl,SBDGroupChannelorChannelMemberListTypeobject.
Use the following code to get the member list of a channel.
Components and features
The SBUMemberListViewController is composed of different types of member list.
| Type | Description |
|---|---|
| A list of members in the channel. |
| A list of operators in the channel. |
| A list of members muted in the channel. |
| A list of members banned from the channel. |
Note: The Add button on the top right is displayed only when
ChannelMemberListTypeis.channelMembersor.operators.
Edit components
The following table lists the customizable properties and method of the SBUMemberListViewController class.
List of methods
| Method | Description |
|---|---|
register(userCell:nib:) | Access level: public |
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
showInviteUser() | Access level: open |
resetMemberList() | Access level: public |
loadNextMemberList(reset:members:) | Access level: public |
nextMemberList() | Access level: open |
loadMembers() | Access level: public |
promoteToOperator(member:) | Access level: public |
dismissOperator(member:) | Access level: public |
mute(member:) | Access level: public |
unmute(member:) | Access level: public |
ban(member:) | Access level: public |
unban(member:) | Access level: public |
setMoreMenuActionHandler(member:) | Access level: open |
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
MemberList_Header_Title | The title of the |
MemberList_Me | A text to indicate which user name belongs to the user themselves. |
MemberList_Promote_Operator | A text for Promote to operator |
MemberList_Dismiss_Operator | A text for Dismiss operator |
MemberList_Mute | A text for Mute |
MemberList_Unmute | A text for Unmute |
MemberList_Ban | A text for Ban |
MemberList_Unban | A text for Unban this member |
MemberList_Title_Members | A text for Members |
MemberList_Title_Operators | A text for Operators |
MemberList_Title_Muted_Members | A text for Muted members |
MemberList_Title_Banned_Members | A text for Banned members |
Note : A set of common strings isn't included in the list. See the
StringSetsection in the Common resources menu.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons.
Note : A set of common icons is not included in the list. See the
IconSetsection in the Common resources menu.
Customize the class
You can subclass and customize the SBUMemberListViewController to enhance the user experience of your app. The overridable methods include:
viewLifeCycle,onClickInviteUser()
Note : We recommend you should fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Set a custom theme
You can customize themes through the SBUTheme.setUserList as below:
Note : You should call the
setupStyle()method afterwards in order to apply any changes you made.
Edit theme elements
Themes can be customized through the SBUTheme. It is recommended to change the theme prior to the viewController initialization. The following code shows how to customize the elements of the theme.
Note : You should call the
setupStyle()method afterwards in order to apply any changes you made.
- SBUUserListTheme
The SBUUserListTheme object has properties used in the following classes: SBUCreateChannelViewController, SBUInviteUserViewController and SBUMemberListViewController.
List of properties
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Navigation bar | leftBarButtonTintColor | The tint color of the button at the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button at the right side of the navigation bar. |
Navigation bar | rightBarButtonSelectedTintColor | The tint color to apply to the button at the right side of the navigation bar when selected. |
Cell | cellTextFont | The text font of the cell |
- SBUUserCellTheme
The SBUUserCellTheme object has properties used in the SBUUserCell.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the view. |
View | separateColor | The color of the separator. |
Check box | checkboxOnColor | The color to apply to a checkbox element when checked. |
Check box | checkboxOffColor | The color to apply to a checkbox element when unchecked. |
User | userNameTextColor | The text color of the user name element. |
User | userNameFont | The font of the user name element. |
Member state | mutedStateBackgroundColor | The Background color of muted members. |
Member state | mutedStateIconColor | The tint color of the muted icon. |
Member state | subInfoTextColor | The text color of members' state info. |
Member state | subInfoFont | The text font of members' state info. |
More menu | moreButtonColor | The color of the more menu button when activated. |
More menu | moreButtonDisabledColor | The color of the more menu button when deactivated. |
Moderate channels and members
You can manage channels and members in the UIKit through the SBUModerationsViewController class. This class enables you to compose a management menu for operators, muted members, and banned members and change the freeze state of a channel.
The class also contains the moderation feature that can be used by a channel operator.
Note : By default, the channel moderation menu in the Channel settings view is activated for operators only.
How to use
Configure the channel moderation tools through a simple implementation of the SBUModerationsViewController class.
Note : You can initialize the
SBUModerationsViewControllerclass by setting aChannelUrlorSBDGroupChannelobject.
Components and features
The SBUModerationsViewController class is composed of items that are required to manage a channel and its members, such as freezing a channel or banning members.
Edit components
The following table lists a set of customizable methods of the SBUModerationsViewController class.
List of methods
| Method | Description |
|---|---|
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
changeFreeze() | Access level: public |
freezeChannel() | Access level: public |
unfreezeChannel() | Access level: public |
showOperatorList() | Access level: open |
showMutedMemberList() | Access level: open |
showBannedMemberList() | Access level: open |
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
ChannelSettings_Moderations | A text for Moderations. |
ChannelSettings_Operators | A text for Operators. |
ChannelSettings_Muted_Members | A text for Muted members. |
ChannelSettings_Banned_Members | A text for Banned members. |
ChannelSettings_Freeze_Channel | A text for Freeze channel. |
Note : A set of common strings isn't included in the list. See the
StringSetsection in the Common resources menu.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons. The iconSet includes:
iconOperator,iconMuted,iconBanned,iconFreeze
Note : A set of common icons is not included in the list. See the
IconSetsection in the Common resources menu.
Customize the class
You can subclass and customize the SBUModerationsViewController class to enhance the user experience of your app. The overridable methods include:
viewLifeCycle
Note : We recommend you fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Set a custom theme
You can customize the channelSettingsTheme through the SBUTheme.setChannelSetting(channelSettingsTheme:) method as below:
Note : You should call the
setupStyle()method to update your user interface. Both theSBUModerationsViewControllerandSBUChannelSettingsViewControllerclass useSBUTheme.channelSettingsTheme.
Edit theme elements
Themes can be customized through the SBUTheme. It is recommended to change the themes prior to viewController initialization. The following code shows how to customize the elements of the theme.
Note : You should call the
setupStyle()method to update your user interface.
- SBUChannelSettingsTheme
The SBUChannelSettingsTheme object shares some of the properties contained in the SBUModerationsViewController.
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Navigation bar | leftBarButtonTintColor | The tint color of the button on the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button on the right side of the navigation bar. |
Navigation bar | backgroundColor | The background color of the navigation bar. |
Status bar | statusBarStyle | The style of the status bar. |
Cell | cellTextFont | The text font of the cell. |
Cell | cellTextColor | The text color of the cell. |
Cell | cellSwitchColor | The color of the on-and-off toggle in the cell. |
Cell | cellSeparateColor | The color of cell separators. |
Cell | cellLeaveIconColor | The color of the leave icon in the cell. |
Cell | cellSubTextFont | The sub text font of the cell. |
Cell | cellSubTextColor | The sub text color of the cell. |
Cell | cellTypeIconTintColor | The color of the type icon in the cell. |
Cell | cellArrowIconTintColor | The color of the arrow icon in the cell. |
User info view | userNameFont | The color of the user name element. |
User info view | userNameTextColor | The text color of the user name element. |
Action sheet | itemTextColor | The text color of the item. |
Search messages
In UIKit, you can search for messages within the SBUChannelViewController through the Search in Channel menu in the SBUChannelSettingsViewController. This will present a SBUMessageSearchViewController, which handles message search and displays the search results. Clicking on the result takes you to a new instance of SBUChannelViewController which features the message selected from the search results, with the keyword highlighted.
How to use
You can create and present the SBUMessageSearchViewController as follows.
Components
The SBUMessageSearchViewController is composed of items that enable message search, such as a search bar and a list of search results.
Edit components
The following table lists the customizable properties and methods of the SBUMessageSearchViewController class.
List of properties
| Property name | Description |
|---|---|
messageListParams | Type: |
customMessageSearchQueryBuilder | Type: |
List of methods
| Method | Description |
|---|---|
register(userCell:nib:) | Access level: public |
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
search(keyword:) | Access level: public |
onClickBack() | Access level: public |
enterChannel(with message:highlightInfo:messageListParams:) | Access level: public |
Theme
The SBUMessageSearchViewController class uses two of the SBUTheme, which are the SBUMessageSearchTheme and the SBUMessageSearchResultCellTheme. The SBUMessageSearchTheme is used for the elements of the SBUMessageSearchViewController while the SBUMessageSearchResultCellTheme is used for the SBUMessageSearchResultCell.
Theme properties cannot be accessed directly and should be customized only through the SBUTheme. Then you should call the setupStyle() afterwards in order to apply any changes you make through the SBUTheme.
- SBUMessageSearchTheme
The SBUMessageSearchTheme object has properties used in the SBUMessageSearchViewController.
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Status bar | statusBarStyle | The style of the status bar. |
View | backgroundColor | The background color of the channel list view. |
Search Field | searchTextColor | The text color of the search text field. |
Search Field | searchTextFont | The font of the search text field. |
Search Field | searchTextBackgroundColor | The background color of the search text field. |
Search Field | searchPlaceholderColor | The text color of the search text field. |
Search Field | searchIconTintColor | The tint color of the search icon. |
Search Field | clearIconTintColor | The tint color of the clear icon. |
Search Field | cancelButtonTintColor | The tint color of the cancel button. |
- SBUMessageSearchResultCellTheme
The SBUMessageSearchResultCellTheme object has properties used in the SBUMessageSearchResultCell.
| Category | Property | Description |
|---|---|---|
View | backgroundColor | The background color of the cell. |
View | separatorLineColor | The color of the separator line. |
Title | titleFont | The font of the title element. |
Title | titleTextColor | The text color of the title element. |
Message | descriptionFont | The font of the message element. |
Message | descriptionTextColor | The text color of the message element. |
File Message | fileMessageFont | The font of the file name in the file message. |
File Message | fileMessageTextColor | The text color of the file name in the file message. |
File Message | fileMessageIconBackgroundColor | The background color of the file icon. |
File Message | fileMessageIconTintColor | The tint color of the file icon. |
Updated time | updatedAtFont | The font of the updated time. |
Updated time | updatedAtTextColor | The text color of the updated time. |
Configure channel settings
In the UIKit, you can display and configure channels through the SBUChannelSettingsViewController class. In the class, you can edit the name and cover image of a channel, change notification status, check the number and list of members in the channel, and leave the specific channel. Also, the moderation menu will be activated if there is an operator in the channel.
Note : Simply setting your chat service to be based on either the channel list or channel can seamlessly lead users to the channel settings view.
How to use
Configure channel settings without complicated implementation through the SBUChannelSettingsViewController class.
Note : You can initialize the
SBUChannelSettingsViewControllerclass by setting theChannelUrlorSBDGroupChannelobject.
Components and features
The SBUChannelSettingsViewController is composed of channel configurations and channel information. The components and features of the SBUChannelSettingsViewController class include:
List of features
| Feature | Description |
|---|---|
Channel cover image | Displays the cover image of a channel. |
Channel name | Displays the name of a channel. |
Change channel cover image | Changes the cover image of a channel. |
Change channel name | Changes the name of a channel. |
Change notification status | Turns on or off the notifications of a channel. |
Channel members | Displays a list of members in a channel and navigate to the member information view. |
Channel update | Updates information of a channel. |
Leave channel | Leaves a channel and return to a channel list. |
Note : The screen shot on the left is the screen visible to general members while the one on the right is visible to operators.
Edit components
The following table lists a set of customizable properties and methods of the SBUChannelSettingsViewController class.
List of properties
| Property name | Type | Description |
|---|---|---|
channelName | String | Edits the name of the channel. |
List of methods
| Method | Description |
|---|---|
| (Deprecated. Use |
errorHandler(_ message:) | Access level: open |
showMemberList() | Access level: open |
showModerationList() | Access level: open |
showSearch() | Access level: open |
updateChannel(channelName:coverImage:) | Access level: public |
updateChannel(params:) | Access level: public |
changeNotification(isOn:) | Access level: public |
leaveChannel() | Access level: public |
selectChannelImage() | Access level: public |
changeChannelName() | Access level: public |
Edit stringSet
The SBUStringSet is a set of strings used to compose the screen. You need to modify the stringSet values in advance if you want to make changes to the screen. The stringSet includes:
List of properties
| Property name | Description |
|---|---|
ChannelSettings_Header_Title | The title of the |
ChannelSettings_Change_Name | A text for Change name. |
ChannelSettings_Change_Image | A text for Change channel image. |
ChannelSettings_Enter_New_Name | A text for Enter name. |
ChannelSettings_Notifications | A text for Notifications status. |
ChannelSettings_Members(count) | A text for (#) members. |
ChannelSettings_Members_Title | A text for Members. |
ChannelSettings_Leave | A text for Leave channel. |
ChannelSettings_Moderations | A text for Moderations. |
ChannelSettings_Operators | A text for Operators. |
ChannelSettings_Muted_Members | A text for Muted members. |
ChannelSettings_Banned_Members | A text for Banned members. |
ChannelSettings_Freeze_Channel | A text for Freeze channel. |
Note : A set of common icons is not included in the list. See the
StringSetsection in the Common resources menu.
Edit iconSet
The SBUIConSet is a set of icons used to compose the screen. You need to modify the iconSet values in advance if you want to use different icons. The iconSet includes:
iconLeave,iconMembers,iconNotifications,iconShevronRight
Note : A set of common icons is not included in the list. See the
IconSetsection in the Common resources menu.
Customize the class
You can subclass and customize the SBUChannelSettingsViewController to enhance the user experience of your app. The overridable methods include:
viewLifeCycle
Note : We recommend you should fully understand the usage of Sendbird Chat SDK for iOS when subclassing the class. Some actions may not work as expected depending on your customization.
Set a custom theme
You can customize the channelSettingsTheme through the SBUTheme.setChannelSetting(channelSettingsTheme:) method as below:
Note : You should call the
setupStyle()method to update your user interface.
Edit theme elements
Themes can be customized through the SBUTheme. It is recommended to change the themes prior to the viewController initialization. The following code shows how to customize the elements of the theme.
Note : You should call the
setupStyle()method to update your user interface.
- SBUChannelSettingsTheme
The SBUChannelSettingsTheme object has properties used in the SBUChannelSettingViewController.
| Category | Property | Description |
|---|---|---|
Navigation bar | navigationBarTintColor | The tint color of the navigation bar. |
Navigation bar | navigationBarShadowColor | The shadow color of the navigation bar. |
Navigation bar | leftBarButtonTintColor | The tint color of the button at the left side of the navigation bar. |
Navigation bar | rightBarButtonTintColor | The tint color of the button at the right side of the navigation bar. |
Navigation bar | backgroundColor | The background color of the navigation bar. |
Status bar | statusBarStyle | The style of the status bar. |
Cell | cellTextFont | The text font of the cell. |
Cell | cellTextColor | The text color of the cell. |
Cell | cellSwitchColor | The color of the on-and-off toggle in the cell. |
Cell | cellSeparateColor | The color of cell separators. |
Cell | cellLeaveIconColor | The color of the leave icon in the cell. |
Cell | cellSubTextFont | The sub text font of the cell. |
Cell | cellSubTextColor | The sub text color of the cell. |
Cell | cellTypeIconTintColor | The color of the type icon in the cell. |
Cell | cellArrowIconTintColor | The color of the arrow icon in the cell. |
User info view | userNameFont | The color of the user name element. |
User info view | userNameTextColor | The text color of the user name element. |
Action sheet | itemTextColor | The text color of the item. |
Action sheet | itemColor | The color of the item. |
Cell |
| (Deprecated. Use |
Cell |
| (Deprecated. Use |
Cell |
| (Deprecated. Use |