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.

Join and leave a group channel

By default, an invitation is required to join group channels. However, any user can join public group channels as a member without invitations as shown below. Users can join up to 2,000 group channels.

if channel.isPublic {
    channel.join { error in
        guard error == nil else {
        // Handle error.
        return
        }

        // The current user successfully joins the group channel.
    }
}

A user can leave group channels as shown below. After leaving, the user can't receive messages from the channel, and this method can't be called for deactivated users.

If the user is the channel's operator, you can remove the user from the channel's operator list by setting the shouldRemoveOperatorStatus parameter to true.

channel.leave { error in
    guard error == nil else {
        // Handle error.
        return
    }
}