---
title: AccessoryTransportAppExtension
framework: accessorytransportextension
role: symbol
role_heading: Protocol
path: accessorytransportextension/accessorytransportappextension
---

# AccessoryTransportAppExtension

A protocol for an extension that transmits data to an accessory you develop.

## Declaration

```swift
protocol AccessoryTransportAppExtension : AppExtension
```

## Mentioned in

Receiving iOS notifications on an accessory

## Overview

Overview Implement this protocol in an extension with an EXExtensionPointIdentifier value of com.apple.accessory-transport-extension to relay data to your accessory. The extension supports sharing Wi-Fi networks and forwarding iOS system notifications. important: The system requires your app extension to have the com.apple.developer.accessory-transport-extension entitlement to use this protocol. Wi-Fi network sharing Use this extension with Wi-Fi Infrastructure to share a Wi-Fi network with your accessory. The system calls your extension’s accept(sessionRequest:) method when it needs to establish a transport session for Wi-Fi sharing. In your extension’s target properties, specify the extension point identifier: <plist>     <dict>         <key>EXAppExtensionAttributes</key>         <dict>             <key>EXExtensionPointIdentifier</key>             <string>com.apple.accessory-transport-extension</string>         </dict>     </dict> </plist> In your extension’s Swift code, implement the protocol and provide an event handler: @main struct TransportExtension: AccessoryTransportAppExtension {     func accept(sessionRequest: AccessoryTransportSession.Request) -> AccessoryTransportSession.Request.Decision {         return sessionRequest.accept {             MyTransportEventHandler(session: sessionRequest.session)         }     } }

class MyTransportEventHandler: AccessoryTransportSession.EventHandler {     func invalidationHandler(error: AccessoryTransportSession.Error?) {         // Clean up when the session ends.     } } After accepting a session, your extension connects directly to the accessory using ASAccessorySession and delivers Wi-Fi network data using WINetworkSharingProvider. Notification forwarding For notification forwarding, set up your extension the same way as for Wi-Fi network sharing. The system invokes your extension to relay encrypted notification data from your app’s AccessoryDataProvider extension to your accessory. Implement dataEventHandler(event:) in your event handler to receive and transmit data: class MyTransportEventHandler: AccessoryTransportSession.EventHandler {     func dataEventHandler(event: AccessoryTransportSession.DataEvent) {         switch event {         case .ciphertext(let data, let featureID):             // Transmit encrypted notification data to accessory over Bluetooth.             sendToAccessory(data)         case .plaintext(let data, let featureID):             // Transmit plaintext data to accessory.             sendToAccessory(data)         }     }          func invalidationHandler(error: AccessoryTransportSession.Error?) {         // Clean up when the session ends.     } } The system encrypts data using keys through your app’s AccessoryTransportSecurity (ATS) extension and then delivers the encrypted data as ciphertext to your handler. Your extension transmits the encrypted data to the accessory, which decrypts the data using shared encryption keys. note: Call cancel(error:) on the session if your extension encounters an error that requires terminating the session.

## Topics

### Accepting session requests

- [accept(sessionRequest:)](accessorytransportextension/accessorytransportappextension/accept(sessionrequest:).md)
- [AccessoryTransportSession.Request.Decision](accessorytransportextension/accessorytransportsession/request/decision.md)

### Handling session events

- [AccessoryTransportSession.EventHandler](accessorytransportextension/accessorytransportsession/eventhandler.md)
- [AccessoryTransportSession.DataEvent](accessorytransportextension/accessorytransportsession/dataevent.md)

### Managing sessions

- [AccessoryTransportSession](accessorytransportextension/accessorytransportsession.md)

## Relationships

### Inherits From

- [AppExtension](extensionfoundation/appextension.md)

## See Also

### Wi-Fi network sharing

- [AccessoryTransportExtensionConfiguration](accessorytransportextension/accessorytransportextensionconfiguration.md)
- [AccessoryTransportSession](accessorytransportextension/accessorytransportsession.md)
- [Wi-Fi Infrastructure](wifiinfrastructure.md)
