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

Retrieve a list of members and operators in a specific order

Copy link

The members and operators of a group channel can be retrieved by calling the loadNextPage(completionHandler:) method of a MemberListQuery instance.

MemberListOrder

Copy link

For a specific order, set one of the options in the following table to the order property of MemberListQueryParams.

ValueDescription

nicknameAlphabetical

Members are arranged in an alphabetical order. This is the default value.

operatorThenMemberNicknameAlphabetical

Operators are listed first, then the members, both in an alphabetical order.

class CustomViewController: ViewController {
    var channel: GroupChannel?
    var query: MemberListQuery?

    func createQuery() {
        self.query = channel?.createMemberListQuery(paramsBuilder: { params in
            // The `params` object is the `MemberListQueryParams` class.
            params.limit = 10
            params.order = .operatorThenMemberNicknameAlphabetical // In alphabetical order by default.
        })
    }

    func loadNextPage() {
        self.query?.loadNextPage { users, error in
            guard error == nil else {
                // Handle error.
                return
            }

            // A list of matching members and operators is successfully retrieved.
            // Through the users parameter of the callback method,
            // you can access the data of each item from the result list
            // that the Sendbird server has passed to the callback method.
        }
    }
}

GroupChannelOperatorFilter

Copy link

For a specific order, set one of the options in the following table to the operatorFilter property of MemberListQueryParams.

ValueDescription

all

No filter is applied to the group channel list. This is the default value.

operator

Only operators are retrieved in the list.

nonOperator

All members, except for operators, are retrieved in the list.

class CustomViewController: ViewController {
    var channel: GroupChannel?
    var query: MemberListQuery?

    func createQuery() {
        self.query = channel?.createMemberListQuery { params in
            // The `params` object is the `MemberListQueryParams` class.
            params.limit = LIMIT
            params.operatorFilter = OPERATOR_FILTER
        }
    }

    func loadNextPage() {
        self.query?.loadNextPage { users, error in
            guard error == nil else {
                // Handle error.
                return
            }

            // A list of matching members and operators is successfully retrieved.
            // Through the users parameter of the callback method,
            // you can access the data of each item from the result list
            // that the Sendbird server has passed to the callback method.
        }
    }
}