Skip to main content

ChatUserListController

_ChatUserListController is a controller class which allows observing a list of chat users based on the provided query.

public class ChatUserListController: DataController, DelegateCallable, DataStoreProvider 

Inheritance

DataController, DelegateCallable, DataStoreProvider

Properties

statePublisher

A publisher emitting a new value every time the state of the controller changes.

public var statePublisher: AnyPublisher<DataController.State, Never> 

usersChangesPublisher

A publisher emitting a new value every time the list of the users matching the query changes.

public var usersChangesPublisher: AnyPublisher<[ListChange<ChatUser>], Never> 

observableObject

A wrapper object that exposes the controller variables in the form of ObservableObject to be used in SwiftUI.

public var observableObject: ObservableObject 

query

The query specifying and filtering the list of users.

public let query: UserListQuery

client

The ChatClient instance this controller belongs to.

public let client: ChatClient

users

The users matching the query of this controller.

public var users: LazyCachedMapCollection<ChatUser> 

To observe changes of the users, set your class as a delegate of this controller or use the provided Combine publishers.

delegate

Set the delegate of UserListController to observe the changes in the system.

public weak var delegate: ChatUserListControllerDelegate? 

Methods

synchronize(_:)

override public func synchronize(_ completion: ((_ error: Error?) -> Void)? = nil) 

setDelegate(_:)

Sets the provided object as a delegate of this controller.

public func setDelegate<Delegate: ChatUserListControllerDelegate>(_ delegate: Delegate) 

Parameters

  • delegate: The object used as a delegate. It's referenced weakly, so you need to keep the object alive if you want keep receiving updates.

loadNextUsers(limit:completion:)

Loads next users from backend.

func loadNextUsers(
limit: Int = 25,
completion: ((Error?) -> Void)? = nil
)

Parameters

  • limit: Limit for page size.
  • completion: The completion. Will be called on a callbackQueue when the network request is finished. If request fails, the completion will be called with an error.

Did you find this page helpful?