---
title: ASAccessorySession
framework: accessorysetupkit
role: symbol
role_heading: Class
path: accessorysetupkit/asaccessorysession
---

# ASAccessorySession

A class to coordinate accessory discovery.

## Declaration

```swift
class ASAccessorySession
```

## Mentioned in

Discovering and configuring accessories

## Overview

Overview Use an instance of ASAccessorySession to interact with the AccessorySetupKit framework. Start the session by calling activate(on:eventHandler:), and pass in a dispatch queue and an event-handling closure. AccessorySetupKit calls back to your event handler as the discovery session processes events. With your event-handler prepared, create an array of ASPickerDisplayItem instances to describe accessories your app can set up. Pass this array to the session’s showPicker(for:completionHandler:) method to allow someone using your app to choose a discovered accessory to set up. Your event handler receives events as the picker appears and dismisses, as well as when the person using the app adds an accessory. important: Starting in iOS 18.4, apps can use AccessorySetupKit for discovery and setup of Bluetooth LE devices that conform to the Human Interface Device (HID) service, such as keyboard and mouse accessories. The HID accessory needs to advertise a custom service besides the HID service. Add the bluetoothHID option to the supportedOptions and configure the ASDiscoveryDescriptor to discover the custom service instead of the HID service.

## Topics

### Managing the session life cycle

- [activate(on:eventHandler:)](accessorysetupkit/asaccessorysession/activate(on:eventhandler:).md)
- [invalidate()](accessorysetupkit/asaccessorysession/invalidate().md)

### Displaying an accessory picker

- [showPicker(completionHandler:)](accessorysetupkit/asaccessorysession/showpicker(completionhandler:).md)
- [showPicker(for:completionHandler:)](accessorysetupkit/asaccessorysession/showpicker(for:completionhandler:).md)

### Customizing picker behavior

- [pickerDisplaySettings](accessorysetupkit/asaccessorysession/pickerdisplaysettings.md)
- [ASPickerDisplaySettings](accessorysetupkit/aspickerdisplaysettings.md)

### Updating the picker

- [updatePicker(showing:completionHandler:)](accessorysetupkit/asaccessorysession/updatepicker(showing:completionhandler:).md)

### Ending filtered discovery

- [finishPickerDiscovery(completionHandler:)](accessorysetupkit/asaccessorysession/finishpickerdiscovery(completionhandler:).md)

### Accessing discovered accessories

- [accessories](accessorysetupkit/asaccessorysession/accessories.md)

### Managing accessories

- [renameAccessory(_:options:completionHandler:)](accessorysetupkit/asaccessorysession/renameaccessory(_:options:completionhandler:).md)
- [ASAccessory.RenameOptions](accessorysetupkit/asaccessory/renameoptions.md)
- [removeAccessory(_:completionHandler:)](accessorysetupkit/asaccessorysession/removeaccessory(_:completionhandler:).md)

### Managing authorization

- [finishAuthorization(for:settings:completionHandler:)](accessorysetupkit/asaccessorysession/finishauthorization(for:settings:completionhandler:).md)
- [ASAccessorySettings](accessorysetupkit/asaccessorysettings.md)
- [failAuthorization(for:completionHandler:)](accessorysetupkit/asaccessorysession/failauthorization(for:completionhandler:).md)
- [updateAuthorization(for:descriptor:completionHandler:)](accessorysetupkit/asaccessorysession/updateauthorization(for:descriptor:completionhandler:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Essentials

- [Setting up and authorizing a Bluetooth accessory](accessorysetupkit/setting-up-and-authorizing-a-bluetooth-accessory.md)
- [Discovering and configuring accessories](accessorysetupkit/discovering-and-configuring-accessories.md)
