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

Common resources

Copy link

This page shows resources that are commonly used and applied to the entire Sendbird UIKit such as global classes and views in view controllers.


Global classes

Copy link

The following shows classes with set values and data that are applied globally to the entire Sendbird UIKit for iOS.

SBUUser

Copy link

The SBUUser class contains user information for Sendbird UIKit for iOS. This can be created through User, Member and Sender. The properties of the classes include userId, nickname, and profileURL values. For member types, the isOperator and isMuted properties are also included.

let user = SBUUser(
    userId: {USER_ID},
    nickname: {NICKNAME},
    profileURL: {PROFILE_URL}
)

Note: Learn more about the classes in the API reference page.

SBUGlobals

Copy link

SBUGlobals is a global class that allows you to set user data such as applicationId, accessToken, and currentUser and feature data such as imageCompressionRate, and replyType that are used across the entire UIKit. You can also decide whether to turn on some features like message grouping and user profile through SBUGlobals.

The values of SBUGlobals must be set before the client app is used. If you need to make changes while the app is running, make sure the values are set before the features are used.

SBUGlobals.currentUser = {USER}
SBUGlobals.isMessageGroupingEnabled = true

Note: Learn more about the class in the API reference page.

SBUGlobalCustomParams

Copy link

You can set global parameters used in group channels and open channels across the UIKit through various builders of SBUGlobalCustomParams. The values of SBUGlobalCustomParams must be set before the client app is used. If you need to make changes while the client app is running, make sure the values are set before the features are used.

SBUGlobalCustomParams.groupChannelParamsCreateBuilder = { params in
    params?.isDistinct = true
}

Note: Learn more about the builders and the class in the API reference page.

SBUAvailable

Copy link

You can see the attributes that are set in the Sendbird application through the SBUAvailable class.

Note: Learn more about the class in the API reference page.


Common views

Copy link

The following are views that are commonly used in view controllers across the UIKit for iOS.

SBUAlertView

Copy link

SBUAlertView is an alert view provided by Sendbird UIKit and is displayed using a keyWindow. You have the option to either show or dismiss the alert view and you can also create buttons and set tap events through SBUAlertButtonItem.

let confirmButton = SBUAlertButtonItem(title: {TEXT}) { _ in }
let cancelButton = SBUAlertButtonItem(title: {TEXT}) { _ in }

SBUAlertView.show(title: {ALERT_TITLE},
    confirmButtonItem: confirmButton,
    cancelButtonItem: cancelButton)

SBUAlertView.dismiss()

Note: Learn more about the class in the API reference page.

SBUActionSheet

Copy link

SBUActionSheet is an action sheet that is provided by Sendbird UIKit. It displays the view using a keyWindow. You have the option to either show or dismiss the alert view and you can also create buttons and set tap events through SBUActionSheetItem.

SBUActionSheet.show(
    items: [
        SBUActionSheetItem(title: {TITLE}, image: {IMAGE}),
        SBUActionSheetItem(title: {TITLE}, image: {IMAGE}),
    ],
    cancelItem: SBUActionSheetItem(title: {ITEM_TITLE}, image: {ITEM_IMAGE})
)

SBUActionSheet.dismiss()

Note: Learn more about the class in the API reference page.

SBUEmptyView

Copy link

SBUEmptyView is an empty view that is provided by Sendbird UIKit. It's used to show an empty table view composed of a set string and icon. There are multiple empty view types in UIKit with corresponding SBUStringSet and SBUIconSet properties that are used to compose the view. For the error type empty view, there is a retry button which, when tapped, sends the didSelectRetry event delegate to the view controller.

Refer to the table below to see the corresponding string and icon for each empty view type. You can customize these strings and icons through SBUStringSet and SBUIconSet.

TypeStringSetIconSet

none

empty string

empty icon

noChannels

Empty_No_Channels

iconChat

noMessages

Empty_No_Messages

iconMessage

noMembers

Empty_No_Users

iconMembers

noMutedMembers

Empty_No_Muted_Members

iconMute

noMutedParticipants

Empty_No_Muted_Participants

iconMute

noBannedUsers

Empty_No_Banned_Users

iconBan

noSearchResults

Empty_Search_Result

iconSearch

error

Empty_Wrong

iconError, iconRefresh

Note: Learn more about the class in the API reference page.

SBUNavigationTitleView

Copy link

SBUNavigationTitleView is a title view in the NavigationBar. It's built with a UILabel that uses the titleFont and titleColor properties of the SBUComponentTheme. You can customize the font and the color by changing the theme.

Note: Learn more about the class in the API reference page.

SBULoading

Copy link

SBULoading is an activity indicator, specifically a loading indicator, that is provided by Sendbird UIKit. It displays the view using a keyWindow and uses the loadingBackgroundColor and loadingPopupBackgroundColor properties of SBUComponentTheme. The class also uses the color values of loadingSpinnerColor of the SBUComponentTheme and the iconSpinner property of the SBUIconSet class to display the view. You have the option to either show or dismiss the view and check if the view is displaying through the isShowing property.

SBULoading.start()
SBULoading.stop()
let isShowing = SBULoading.isShowing

Note: Learn more about the class in the API reference page.

SBUCoverImageView

Copy link

SBUCoverImageView is used to create a view of a channel's cover image. It provides various setter methods and allows you to upload either an image file or an image URL. You can set a placeholder image as the default cover image and allow only certain image types to be used as the cover image. By using a list of User objects, you can also use a cover image based on the channel members' profile images.

Note: Learn more about the class in the API reference page.