Chat UIKit iOS UIKit v2
Chat UIKit iOS UIKit
Chat UIKit
iOS UIKit
Version 2
Sendbird Chat UIKit v2 for iOS UIKit is no longer supported as a new version is released. Check out our latest Chat UIKit v3

File sharing

Copy link

File sharing is a feature that allows users to send files such as images, audio files, and videos while chatting in a channel. File sharing appears in the messageInput component of the SBUChannelViewController class.

In UIKit for iOS, there are currently four different types of file messages that users can send: image file, video file, audio file, and document file. These files can be shared with other members in the channel by either directly taking a photo with the camera on a mobile device or uploading an image, video, audio, or document file from the sender’s mobile device.

Note : In order to use the file sharing 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 channel.

Customize the UI for file sharing

Copy link

You can customize the UI for file sharing using SBUMessageCellTheme in the SBUTheme, SBUStringSet, and SBUIconSet.

SBUMessageCellTheme

Copy link

The following table shows customizable theme properties of file sharing.

CategoryPropertyDescription

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.

SBUStringSet

Copy link

The following table lists customizable properties of SBUStringSet that can be modified to customize file sharing. 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.

Property nameDescription

Channel_Success_Download_file

A text for file save completion.

Channel_Failure_Download_file

A text for file save failure.

Channel_Failure_Open_file

A text for file open failure.

SBUIconSet

Copy link

The following table shows customizable file sharing icons.

Icon nameImageDescription

iconAdd

Add a file.

iconDocument

Select a file to send.

iconFileAudio

An audio file message.

iconFileDocument

A document file message.

iconGif

A GIF, Graphics Interchange Format, file message.

iconPlay

Play a video file message.


Image compression

Copy link

UIKit for iOS allows users to compress images when sending them to other users in the channel on the client app. By reducing the image size, they can send and receive image files faster and minimize data storage and data usage.

The following table lists properties in the SBUGlobals class that are related to image compression. These properties can be customized before you initialize UIKit or create a new channel.

PropertyTypeDescription

UsingImageCompression

Bool

Determines whether to compress the image when sending an image file message. (Default: false)

imageCompressionRate

CGFloat

The value of the compression rate to apply to the image. Acceptable values are 0.0 to 1.0, inclusive. (Default: 0.85)

imageResizingSize

CGSize

The value of the size dimensions to apply to the image. (Default: device screen size)

Note: To compress an image without changing the size dimensions, use the imageCompressionRate property. To resize the image, use the imageResizingSize property.

SwiftObjective-C
SBUGlobals.UsingImageCompression = true
SBUGlobals.imageCompressionRate = 0.85
SBUGlobals.imageResizingSize = CGSize(width: 480, height: 480)