Chat UIKit iOS UIKit v3
Chat UIKit iOS UIKit
Chat UIKit
iOS UIKit
Version 3

Typing indicator

Copy link

Typing indicator is a feature that allows users to know visually if another user in the channel is typing a message. The indicator remains visible until the user sends the message or deletes the text completely. It will also disappear when the user stops typing for more than 10 seconds.


We support two types of typing indicators: Text and Bubble.

The text typing indicator can be used in the following places.

  • In the channel list as shown in the left image. This is the listComponent of the SBUGroupChannelListViewController module.
  • In the channel as shown in the right image. This is the header component of the SBUGroupChannelViewController class.

Note : In order to use the typing indicator feature, you must first create a channel and enable the chat service. To learn how to allow users to chat in a channel, refer to Chat in a group channel.

Bubble

Copy link

The bubble typing indicator can be used in the following place.

  • In the channel. This is the list component of the SBUGroupChannelViewController class.

Note that the bubble typing indicator is not supported in the SBUGroupChannelListViewController module.


How to use in channel

Copy link

You can enable text and bubble typing indicators in your channel by following the code below. By default, the .text type of typing indicator is turned on. However, you can also enable the .bubble type here, or use both types at the same time.

SendbirdUI.config.groupChannel.channel.isTypingIndicatorEnabled = true
SendbirdUI.config.groupChannel.channel.typingIndicatorTypes = [.text, .bubble]

How to use in channel list

Copy link

You can enable the text typing indicator in the channel list by following the code below. You need to set the feature's setter method to true in the SBUGroupChannelListViewController module. The bubble typing indicator is not supported in this module.

SendbirdUI.config.groupChannel.channelList.isTypingIndicatorEnabled = true

Customize the text typing indicator UI

Copy link

The UI for text typing indicator can be customized through SBUStringSet. 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.

Text strings for typing status can vary depending on the number of members typing in a channel:

  • If one member is typing: “Member is typing...”
  • If two members are simultaneously typing: “Member A and Member B are typing...”
  • If more than two members are simultaneously typing: “Several people are typing...”

SBUStringSet

Copy link

The following table lists customizable properties of SBUStringSet that can be modified to customize text typing indicator.

Property nameDescription

Channel_Typing (typingMembers)

A text for a member’s typing status.

Customize the bubble typing indicator UI

Copy link

The UI for bubble typing indicator can be customized by registering your custom SBUTypingIndicatorMessageCell to the listComponent of the SBUGroupChannelViewController.

class MyTypingIndicatorMessageCell: SBUTypingIndicatorMessageCell {

}

listComponent.register(typingIndicatorMessageCell: MyTypingIndicatorMessageCell)

You can also customize the bubble view by overriding typingBubbleView of SBUTypingIndicatorMessageCell with your custom UIView.

class MyTypingIndicatorMessageCell: SBUTypingIndicatorMessageCell {
    override lazy var typingBubbleView: MyTypingBubbleView = {
    let myTypingBubble = MyTypingBubbleView()
    // ... 
    return myTypingBubble
    }()
}

listComponent.register(typingIndicatorMessageCell: MyTypingIndicatorMessageCell)