chat-user-controller-properties
statePublisher
A publisher emitting a new value every time the state of the controller changes.
public var statePublisher: AnyPublisher<DataController.State, Never>
userChangePublisher
A publisher emitting a new value every time the user changes.
public var userChangePublisher: AnyPublisher<EntityChange<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
userId
The identifier of the user this controller observes.
public let userId: UserId
client
The ChatClient
instance this controller belongs to.
public let client: ChatClient
user
The user the controller represents.
public var user: ChatUser?
To observe changes of the user, set your class as a delegate of this controller or use the provided
Combine
publishers.
delegate
Set the delegate of ChatUserController
to observe the changes in the system.
var delegate: ChatUserControllerDelegate?
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: ChatUserControllerDelegate>(_ 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.
mute(completion:)
Mutes the user this controller manages.
func mute(completion: ((Error?) -> Void)? = nil)
Parameters
completion
: The completion. Will be called on acallbackQueue
when the network request is finished. If request fails, the completion will be called with an error.
unmute(completion:)
Un-mutes the user this controller manages.
func unmute(completion: ((Error?) -> Void)? = nil)
Parameters
completion
: The completion. Will be called on acallbackQueue
when the network request is finished.
flag(completion:)
Flags the user this controller manages.
func flag(completion: ((Error?) -> Void)? = nil)
Parameters
completion
: The completion. Will be called on acallbackQueue
when the network request is finished. If request fails, the completion will be called with an error.
unflag(completion:)
Un-flags the user this controller manages.
func unflag(completion: ((Error?) -> Void)? = nil)