Contents

AccessoryFeatureSessionHandler

A protocol that receives events from a data provider extension’s feature session.

Declaration

protocol AccessoryFeatureSessionHandler<Session> : Sendable

Overview

Conform to this protocol in your data provider extension to respond to the AccessoryFeatureSession life cycle and incoming data. The system creates an instance of your type from the handler factory closure you provide when you declare the feature. Pass the closure to init(_:) once for each session that starts.

A handler that serves one feature can’t serve another because each feature pins the Session associated type through its own Handler type alias (for example, AccessoryWorker.Handler).

Implement sessionStarted(_:) to hold the session weakly, and implement dataReceived(_:) to process data that the transport extension sends.

Topics

Handling the session life cycle

Receiving data

Associated Types

See Also

Managing feature sessions