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

Retrieve a list of muted users

You can create a query to retrieve a list of muted users in both open and group channels. Only users registered as channel operators may use the following code.

Open channel

class CustomViewController: ViewController {
    var channel: OpenChannel?
    var query: MutedUserListQuery?
    
    func createQuery() {
        // Retrieve muted users.
        self.query = channel?.createMutedUserListQuery()
    }
    
    func loadNextPage() {
        self.query?.loadNextPage { (users, error) in
            guard error == nil else {
                // Handle error.
                return
            }
        }
    }
}

Group channel

class CustomViewController: ViewController {
    var channel: GroupChannel?
    var query: MutedUserListQuery?
    
    func createQuery() {
        // Retrieve muted users.
        self.query = channel?.createMutedUserListQuery()
    }
    
    func loadNextPage() {
        self.query?.loadNextPage { users, error in
            guard error == nil else {
                // Handle error.
                return
            }
            // A list of muted members is successfully retrieved.
        }
    }
}