AccessoryDataProvider
A protocol for an extension that receives iOS system notifications and curates their data for your accessory.
Declaration
protocol AccessoryDataProvider : AppExtension, Sendable where Self.Configuration : AccessoryDataProviderConfigurationMentioned in
Overview
Implement this protocol in an extension with an EXExtensionPointIdentifier value of com.apple.accessory-data-provider to receive notification data for eventual forwarding to an accessory that you develop. The extension runs in a sandboxed environment and communicates with the system through the extension’s configuration object (AccessoryDataProviderConfiguration).
Add the necessary target configuration
In your extension’s target properties, include the _EXExtensionCapabilities key with the value AccessoryNotifications.NotificationsForwarding:
<plist>
<dict>
<key>EXAppExtensionAttributes</key>
<dict>
<key>EXExtensionPointIdentifier</key>
<string>com.apple.accessory-data-provider</string>
<key>EXCapabilities</key>
<array>
<string>AccessoryNotifications.NotificationsForwarding</string>
</array>
</dict>
</dict>
</plist>Implement the extension point
In your extension’s Swift code, implement the protocol and declare the capability with your NotificationsForwarding.AccessoryNotificationsHandler implementation:
struct DataProvider: AccessoryDataProvider {
var extensionPoint: AppExtensionPoint {
Identifier("com.apple.accessory-data-provider")
Implementing {
NotificationsForwarding {
MyNotificationsHandler()
}
}
}
}
class MyNotificationsHandler: AccessoryNotificationsHandler {
// Your implementation.
}For more information, see Receiving iOS notifications on an accessory.