Chat / iOS
Chat iOS v4
Chat iOS
Chat
iOS
Home
/
Chat
/
iOS
/
Channel
This is the new Docs for Chat SDK v4 for iOS. To see the previous Docs, click here.

Categorize channels by custom type

When creating an open channel or a group channel, you can additionally specify a custom channel type to subclassify channels. This custom type takes on the form of a string, and can be useful in searching or filtering channels.

The data and customType properties of a channel object allow you to append information to channels. While both properties can be used flexibly, common examples for customType include categorizing channels as "Personal" or "Work."

To get a channel's custom type, read channel.customType for both open and group channels.

Open channel

let params = OpenChannelCreateParams()
params.name = CHANNEL_NAME
params.coverURL = COVER_URL
params.data = DATA
params.customType = CUSTOM_TYPE
params.setOperators(OPERATOR_USERS)

OpenChannel.createChannel(params: params) { (openChannel, error) in
    guard error == nil else {
        // Handle error.
        return 
    }
}

Group channel

let params = GroupChannelCreateParams()
params.name = CHANNEL_NAME
params.coverURL = COVER_URL
params.data = DATA
params.customType = CUSTOM_TYPE
params.setOperators(OPERATOR_USERS)

GroupChannel.createChannel(params: params) { (channel, error) inin
    guard error == nil else {
        // Handle error.
        return 
    }
}