<!--
{
  "availability" : [
    "iOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryTransportExtension",
  "identifier" : "/documentation/AccessoryTransportExtension/AccessoryWorker/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Accessory Transport Extension"
    ],
    "preciseIdentifier" : "s:27AccessoryTransportExtension0A6WorkerVyAcA0A21FeatureSessionHandler_pAC0F0CAeaDPRts_XPyYbccfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Initializes a worker feature with a handler factory.

```
init(_ handlerFactory: @escaping @Sendable () -> any AccessoryFeatureSessionHandler<AccessoryWorker.Session>)
```

## Parameters

`handlerFactory`

A closure that creates the handler for each session of the feature.

## Discussion

Create the instance inside your data provider extension’s `extensionPoint`. The system calls the closure to create a new handler for each session. For more information, see [Sending data to an accessory in the background](/documentation/AccessoryTransportExtension/sending-data-to-an-accessory-in-the-background).

---

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)