CallClientObserver

@available(iOS 12.0, *)
@objc(BDKCallClientObserver)
public protocol CallClientObserver : NSObjectProtocol

An observer of a call client object.

You subscribe as a CallClientObserver when you want to react about CallClient object state changes. You are required to implement at least the callClientDidChangeState(_:oldState:newState:) method invoked after the CallClient has changed its state

  • An optional method invoked when the CallClient is about to change its state.

    Implement this method when you want to react before the CallClient change its internal state. This method provides the current state of the client and the new state the client will transition to.

    Important

    If you subscribe as an asynchronous observer, the current state you are going to get from the client parameter won’t match the value from the currentState parameter

    Declaration

    Swift

    @objc(callClientWillChangeState:oldState:newState:)
    optional func callClientWillChangeState(_ client: CallClient, oldState: CallClientState, newState: CallClientState)

    Parameters

    client

    The chat client object.

    oldState

    The state the chat client is about to leave.

    newState

    The state the chat client is about to transition to.

  • A method invoked when the CallClient changed its state.

    Implement this method when you want to react after the CallClient changed its internal state. This method provides the new state the client has transitioned to and the old state the client was in before the transition occurred.

    Declaration

    Swift

    @objc(callClientDidChangeState:oldState:newState:)
    func callClientDidChangeState(_ client: CallClient, oldState: CallClientState, newState: CallClientState)

    Parameters

    client

    The chat client object.

    oldState

    The state the chat client was in before the transition occurred.

    newState

    The state the chat client transitioned to.

  • An optional method invoked when the CallClient has failed.

    Implement this method when you want to react after the CallClient has failed, getting the cause of the failure as a method parameter.

    Declaration

    Swift

    @objc(callClient:didFailWithError:)
    optional func callClient(_ client: CallClient, didFailWithError error: Error)

    Parameters

    client

    The chat client object.

    error

    The error occurred.