UIKit iOS v3
UIKit iOS
UIKit
iOS
Home
/
UIKit
/
iOS
This is the new Docs for UIKit v3 beta for iOS. To see the previous Docs, click here.

Common resources

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

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

SBUUser

The SBUUser class contains information of the current user. This can be created through SBDUser, SBDMember or Sendbird UIKit for iOS. The properties of the class 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 class in the API reference page.

SBUGlobals

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 ReplyTypeToUse 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

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

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

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

SBUAlertView

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

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

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

noBannedMembers

Empty_No_Banned_Members

iconBan

noSearchResults

Empty_Search_Result

iconSearch

error

Empty_Wrong

iconError, iconRefresh

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

SBUNavigationTitleView

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

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 the SBUComponentTheme. The class also uses the color values of loadingSpinnerColor 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.show()
SBULoading.dismiss()

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

SBUCoverImageView

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 SBDUser 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.