<!--
{
  "availability" : [
    "iOS: 26.5.0 -",
    "iPadOS: 26.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryTransportExtension",
  "identifier" : "/documentation/AccessoryTransportExtension/AccessoryDataProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Accessory Transport Extension"
    ],
    "preciseIdentifier" : "s:27AccessoryTransportExtension0A12DataProviderP"
  },
  "title" : "AccessoryDataProvider"
}
-->

# AccessoryDataProvider

A protocol for an extension that receives iOS system notifications and curates their data for your accessory.

```
protocol AccessoryDataProvider : AppExtension, Sendable where Self.Configuration : AccessoryDataProviderConfiguration
```

## 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`](/documentation/AccessoryTransportExtension/AccessoryDataProviderConfiguration)).

> Important: The system requires your app extension to have the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.accessory-data-provider> entitlement to use this protocol.

## Add the necessary target configuration

In your extension’s target properties, include the `EXCapabilities` key with the value `AccessoryNotifications.NotificationsForwarding`:

```xml
<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 <doc://com.apple.documentation/documentation/AccessoryNotifications/NotificationsForwarding/AccessoryNotificationsHandler> implementation:

```swift
struct DataProvider: AccessoryDataProvider {
    var extensionPoint: AppExtensionPoint {
        Identifier("com.apple.accessory-data-provider")
        Implementing {
            NotificationsForwarding {
                MyNotificationsHandler()
            }
        }
    }
}

class MyNotificationsHandler: AccessoryNotificationsHandler {
    // Your extension's implementation.
}
```

## Share data between the app and the extension

Configure a shared app group so your companion app can provide information to the extension. The extension has read-only access to the shared container. Use the shared container to store:

- Authentication tokens for your private servers
- Accessory-specific preferences (max payload size, content filtering)
- Device-specific configuration

```swift
// In the companion app, write to the shared container.
let sharedDefaults = UserDefaults(suiteName: "group.com.yourcompany.accessoryapp")
sharedDefaults?.set(authToken, forKey: "ServerAuthToken")

// In the extension, read from the shared container.
let sharedDefaults = UserDefaults(suiteName: "group.com.yourcompany.accessoryapp")
let authToken = sharedDefaults?.string(forKey: "ServerAuthToken")
```

For more information, see [Receiving iOS notifications on an accessory](/documentation/AccessoryTransportExtension/receiving-ios-notifications-on-an-accessory).

## Relationships

### Inherits From

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`AppExtension`](/documentation/ExtensionFoundation/AppExtension)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)