/ SDKs / iOS
SDKs
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
iOS
Version 4

Retrieve a list of muted users

Copy link

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

Copy link
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

Copy link
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.
        }
    }
}