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.

Register and remove operators

Operators are users who can delete any messages and view all messages in an open or group channel without any filtering or throttling. Operators can moderate channels by muting or banning users as well as freezing channels.

You can register users as an operator by providing their user IDs as shown below.

channel.addOperators(userIds: [USER_ID_1, USER_ID_2]) { error in
    guard error == nil else {
        // Handle error.
        return
    }

    // The members are successfully registered as operators of the channel.
}

You can remove the users from being operators but leave them in the channel using the following code.

channel.removeOperators(userIds: [USER_ID_1, USER_ID_2]) { error in
    guard error == nil else {
        // Handle error.
        return
    }

    // The specified operators are removed.
    // You can notify the users of the role change through a prompt.
}

If you want to cancel the registration of all operators in a channel at once, use the following code.

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

    // All operators are removed.
    // You can notify the users of the role change through a prompt.
}