IVSStage
Objective-C
@interface IVSStage : NSObject <IVSErrorSource>
Swift
class IVSStage : NSObject, IVSErrorSource
The main interaction point for interacting with the Stage SDK.
-
Creates an
IVSStagewith the provided token.Note
The
IVSStageholds a weak reference to theIVSStageStrategyobject.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) throwsParameters
tokenA token acquired by the IVS control plane, used to connect to a Stage.
strategyThe strategy used by this stage to make decisions. See
IVSStageStrategyfor more information.outErrorOn 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() throwsParameters
outErrorOn 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, andexp.Note
If the exchange fails, the Stage will be left and must be rejoined with a new
IVSStageobject.Declaration
Objective-C
- (BOOL)exchangeToken:(nonnull NSString *)token error:(NSError *_Nullable *_Nullable)outError;Swift
func exchangeToken(_ token: String) throwsParameters
tokenThe new token containing updated metadata.
outErrorA 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
rendererThe 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
rendererThe renderer to remove.
-
Asynchronously sets the strategy used by this
IVSStage. SeeIVSStageStrategyfor more information.Note
The
IVSStageholds a weak reference to theIVSStageStrategyobject.Declaration
Objective-C
- (void)replaceStrategy:(nonnull id<IVSStageStrategy>)strategy;Swift
func replaceStrategy(_ strategy: any IVSStageStrategy)Parameters
strategyThe new strategy to use with the Stage.
-
Triggers the
IVSStageStrategyon 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()