---
title: "makeFeatureSession(_:)"
framework: Accessory Transport Extension
role: symbol
role_heading: Instance Method
platforms: [iOS 27.3+]
path: "accessorytransportextension/accessorytransportsession/makefeaturesession(_:)"
---

# makeFeatureSession(_:)

Creates a feature session for the provided handler.

## Declaration

```swift
func makeFeatureSession<H>(_ handlerFactory: () -> H) throws(AccessoryTransportSession.Error) -> H.Session where H : AccessoryFeatureRuntimeSessionHandler
```

## Parameters

- `handlerFactory`: A closure that creates the handler for the new session.

## Mentioned in

Sending data to an accessory in the background

## Discussion

Discussion This method requires a Bluetooth transport and throws AccessoryTransportSession.Error.unsupported otherwise. It throws AccessoryTransportSession.Error.invalidated if the transport session isn’t valid. It doesn’t fail when the feature isn’t enrolled for the accessory; see activate() for when the session starts. The returned session does nothing until you call activate(), and you need to call invalidate() before releasing an activated session. Your transport extension calls this method. A data provider extension can’t create a feature session or wake your transport extension on its own. Call this method in response to an event from your accessory, such as a Bluetooth characteristic update. Only the worker features, AccessoryWorker and AccessoryGPUWorker, use feature sessions that you create this way; for more information, see Accessory features.
