IVSStage

Objective-C


@interface IVSStage : NSObject <IVSErrorSource>

Swift

class IVSStage : NSObject, IVSErrorSource

The main interaction point for interacting with the Stage SDK.

  • Creates an IVSStage with the provided token.

    Note

    The IVSStage holds a weak reference to the IVSStageStrategy object.

    Declaration

    Objective-C

    - (nullable instancetype)initWithToken:(nonnull NSString *)token
                                  strategy:(nonnull id<IVSStageStrategy>)strategy
                                     error:(NSError *_Nullable *_Nullable)outError;

    Swift

    init(token: String, strategy: any IVSStageStrategy) throws

    Parameters

    token

    A token acquired by the IVS control plane, used to connect to a Stage.

    strategy

    The strategy used by this stage to make decisions. See IVSStageStrategy for more information.

    outError

    On input, a pointer to an error object. If an error occurs, the pointer is an NSError object that describes the error. If you don’t want error information, pass in nil.

  • Joins the Stage associated with the token provided during initialization.

    Declaration

    Objective-C

    - (BOOL)joinWithError:(NSError *_Nullable *_Nullable)outError;

    Swift

    func join() throws

    Parameters

    outError

    On input, a pointer to an error object. If an error occurs, the pointer is an NSError object that describes the error. If you don’t want error information, pass in nil.

  • Exchanges the current session token with a new token while maintaining existing publish and subscribe connections. This allows updating capabilities, attributes, or userId without disrupting the current stage session. If capabilities are revoked compared to the previous token, this will result in unpublishing or unsubscribing as necessary. Renderer callbacks will be invoked on any changes.

    Note

    This method should only be called after successfully joining a stage.

    Note

    Only the following token fields can be updated: capabilities, attributes, user_id, and exp.

    Note

    If the exchange fails, the Stage will be left and must be rejoined with a new IVSStage object.

    Declaration

    Objective-C

    - (BOOL)exchangeToken:(nonnull NSString *)token
                    error:(NSError *_Nullable *_Nullable)outError;

    Swift

    func exchangeToken(_ token: String) throws

    Parameters

    token

    The new token containing updated metadata.

    outError

    A reference to an NSError that would be set if an error occurs.

    Return Value

    if the operation is successful.

  • Leave the current Stage

    Declaration

    Objective-C

    - (void)leave;

    Swift

    func leave()
  • Adds a renderer to the list of renderers that will be notified of updates to the Stage.

    Declaration

    Objective-C

    - (void)addRenderer:(nonnull id<IVSStageRenderer>)renderer;

    Swift

    func addRenderer(_ renderer: any IVSStageRenderer)

    Parameters

    renderer

    The renderer to add.

  • Removes a renderer to the list of renderers that will be notified of updates to the Stage.

    Declaration

    Objective-C

    - (void)removeRenderer:(nonnull id<IVSStageRenderer>)renderer;

    Swift

    func remove(_ renderer: any IVSStageRenderer)

    Parameters

    renderer

    The renderer to remove.

  • Asynchronously sets the strategy used by this IVSStage. See IVSStageStrategy for more information.

    Note

    The IVSStage holds a weak reference to the IVSStageStrategy object.

    Declaration

    Objective-C

    - (void)replaceStrategy:(nonnull id<IVSStageStrategy>)strategy;

    Swift

    func replaceStrategy(_ strategy: any IVSStageStrategy)

    Parameters

    strategy

    The new strategy to use with the Stage.

  • Triggers the IVSStageStrategy on this instance to refresh its state. This is how host applications will make changes to how they are interacting with a Stage.

    Declaration

    Objective-C

    - (void)refreshStrategy;

    Swift

    func refreshStrategy()