### Customizing setup options Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct This section details how to customize setup options for an accessory using ASPickerDisplayItem.SetupOptions and related structures. ```APIDOC ## Customizing setup options ### See Also - `var setupOptions: ASPickerDisplayItem.SetupOptions` Custom setup options for the accessory. - `var renameOptions: ASAccessory.RenameOptions` Options to allow renaming a matched accessory. - `struct RenameOptions` Options that affect the behavior of an accessory renaming operation. ``` -------------------------------- ### ASPickerDisplayItem SetupOptions Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem Defines setup options for the accessory picker. ```APIDOC ## `struct SetupOptions` ### Description Setup options offered by the accessory picker. ### Properties - **renameOptions** (ASAccessory.RenameOptions) - Options to allow renaming a matched accessory. ``` -------------------------------- ### ASPickerDisplayItem.SetupOptions Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct/finishinapp Configuration options for accessory setup within the AccessorySetupKit framework. ```APIDOC ## ASPickerDisplayItem.SetupOptions ### Description Options used to configure the behavior of the accessory setup picker. ### Properties - **finishInApp** (static var) - An option to ask the person setting up the accessory to finish additional setup in the app after the accessory is authorized. - **rename** (static var) - An option to ask the person using the app to rename the accessory. - **confirmAuthorization** (static var) - An option to require the app to finish accessory authorization before showing the setup view. ### Availability - iOS 18.0+ - iPadOS 18.0+ ``` -------------------------------- ### Access setupOptions property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/renameoptions Provides custom setup options for the accessory picker. ```swift var setupOptions: ASPickerDisplayItem.SetupOptions ``` -------------------------------- ### Finish Setup In App Option Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct/finishinapp Use this option to prompt the user to complete accessory setup within your app after the accessory has been authorized. Available on iOS 18.0+ and iPadOS 18.0+. ```swift static var finishInApp: ASPickerDisplayItem.SetupOptions { get } ``` -------------------------------- ### ASPickerDisplayItem.SetupOptions.confirmAuthorization Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct/confirmauthorization An option to require the app to finish accessory authorization before showing the setup view. ```APIDOC ## static var confirmAuthorization ### Description An option to require the app to finish accessory authorization before showing the setup view. If the accessory supports bluetoothPairingLE, the app must start pairing by accessing a protected GATT characteristic. ### Availability - iOS 18.0+ - iPadOS 18.0+ ### Declaration `static var confirmAuthorization: ASPickerDisplayItem.SetupOptions { get }` ``` -------------------------------- ### ASAccessorySession Overview Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession Provides an overview of how to use ASAccessorySession to interact with the AccessorySetupKit framework for accessory discovery and setup. ```APIDOC ## ASAccessorySession ### Description A class to coordinate accessory discovery. ### 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. ``` -------------------------------- ### ASPickerDisplayItem.SetupOptions Structure Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct The SetupOptions structure defines the available configuration options for the accessory picker's setup process. ```APIDOC ## ASPickerDisplayItem.SetupOptions Structure Setup options offered by the accessory picker. ### Creating an options instance `init(rawValue: UInt)` ### Options `static var rename: ASPickerDisplayItem.SetupOptions` An option to ask the person using the app to rename the accessory. `static var confirmAuthorization: ASPickerDisplayItem.SetupOptions` An option to require the app to finish accessory authorization before showing the setup view. `static var finishInApp: ASPickerDisplayItem.SetupOptions` An option to ask the person setting up the accessory to finish additional setup in the app after the accessory is authorized. ### Conforms To - `BitwiseCopyable` - `Equatable` - `ExpressibleByArrayLiteral` - `OptionSet` - `RawRepresentable` - `Sendable` - `SendableMetatype` - `SetAlgebra` ``` -------------------------------- ### ASAccessoryEventType.pickerSetupFailed Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetupfailed Represents the event where the discovery session picker setup has failed. ```APIDOC ## ASAccessoryEventType.pickerSetupFailed ### Description The discovery session picker setup failed. ### Availability - iOS 18.0+ - iPadOS 18.0+ - Mac Catalyst ### Definition ```swift case pickerSetupFailed ``` ``` -------------------------------- ### Activate Accessory Session Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/activate%28on%3Aeventhandler%3A%29 Starts the session and registers a handler for accessory events on the specified dispatch queue. ```swift func activate( on queue: dispatch_queue_t, eventHandler: @escaping (ASAccessoryEvent) -> Void ) ``` -------------------------------- ### Confirm Authorization Option Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct/finishinapp Use this option to require the app to finish accessory authorization before displaying the setup view. This ensures authorization is complete before proceeding. ```swift static var confirmAuthorization: ASPickerDisplayItem.SetupOptions ``` -------------------------------- ### ASAccessoryEventType.pickerSetupRename Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetuprename The discovery session picker started renaming an accessory. ```APIDOC ## ASAccessoryEventType.pickerSetupRename ### Description The discovery session picker started renaming an accessory. ### Availability iOS 18.0+ iPadOS 18.0+ Mac Catalyst ### Code Example ```swift case pickerSetupRename ``` ### See Also - `case pickerDidPresent`: The discovery session picker appeared. - `case pickerDidDismiss`: The discovery session picker dismissed. - `case pickerSetupBridging`: The discovery session picker started bridging with an accessory. - `case pickerSetupPairing`: The discovery session picker started pairing with a Bluetooth accessory. - `case pickerSetupFailed`: The discovery session picker setup failed. ``` -------------------------------- ### Define pickerSetupFailed event case Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetupfailed Represents the failure state of the discovery session picker setup. ```swift case pickerSetupFailed ``` -------------------------------- ### Define pickerSetupPairing event case Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetuppairing Represents the state where the discovery session picker has started pairing with a Bluetooth accessory. ```swift case pickerSetupPairing ``` -------------------------------- ### ASPickerDisplayItem Properties Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem Properties for customizing the display and setup behavior of an ASPickerDisplayItem. ```APIDOC ## ASPickerDisplayItem Properties ### Description Properties to customize the accessory's name, image, discovery criteria, and setup options. ### Properties - **name** (String) - The accessory name to display in the picker. - **productImage** (UIImage) - An image of the accessory to display in the picker. - **descriptor** (ASDiscoveryDescriptor) - A descriptor that the picker uses to determine which discovered accessories to display. - **setupOptions** (ASPickerDisplayItem.SetupOptions) - Custom setup options for the accessory. - **renameOptions** (ASAccessory.RenameOptions) - Options to allow renaming a matched accessory. ``` -------------------------------- ### Rename Accessory Option Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct/finishinapp Use this option to prompt the user to rename the accessory. This is one of the available setup options. ```swift static var rename: ASPickerDisplayItem.SetupOptions ``` -------------------------------- ### Access Default Accessory Settings Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings Retrieves an empty settings object to initialize or modify accessory settings. Use this to start configuring an accessory. ```swift class var `default`: ASAccessorySettings ``` -------------------------------- ### GET ASDiscoveredAccessory.bluetoothAdvertisementData Source: https://developer.apple.com/documentation/accessorysetupkit/asdiscoveredaccessory/bluetoothadvertisementdata Retrieves the Bluetooth advertisement data associated with a discovered accessory. ```APIDOC ## Property: bluetoothAdvertisementData ### Description The Bluetooth advertisement data from the discovered accessory. ### Availability - iOS 26.1+ - iPadOS 26.1+ ### Declaration ```swift var bluetoothAdvertisementData: [AnyHashable : Any]? { get } ``` ``` -------------------------------- ### ASAccessoryEventType.pickerSetupBridging Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetupbridging The discovery session picker started bridging with an accessory. This event is available on iOS 18.0+, iPadOS 18.0+, and Mac Catalyst. ```APIDOC ## ASAccessoryEventType.pickerSetupBridging ### Description The discovery session picker started bridging with an accessory. ### Availability iOS 18.0+ iPadOS 18.0+ Mac Catalyst ### Code Example ```swift case pickerSetupBridging ``` ### See Also - `case pickerDidPresent`: The discovery session picker appeared. - `case pickerDidDismiss`: The discovery session picker dismissed. - `case pickerSetupPairing`: The discovery session picker started pairing with a Bluetooth accessory. - `case pickerSetupFailed`: The discovery session picker setup failed. - `case pickerSetupRename`: The discovery session picker started renaming an accessory. ``` -------------------------------- ### ASAccessoryEventType.pickerSetupPairing Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetuppairing The discovery session picker started pairing with a Bluetooth accessory. Available on iOS 18.0+, iPadOS 18.0+, and Mac Catalyst. ```APIDOC ## ASAccessoryEventType.pickerSetupPairing ### Description The discovery session picker started pairing with a Bluetooth accessory. ### Availability iOS 18.0+, iPadOS 18.0+, Mac Catalyst ### Case ```swift case pickerSetupPairing ``` ``` -------------------------------- ### AccessorySetupKit confirmAuthorization Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/setupoptions-swift.struct/confirmauthorization Use this static property to enforce accessory authorization before the setup view appears. It is specifically relevant when the accessory requires Bluetooth LE pairing via a protected GATT characteristic. ```Swift static var confirmAuthorization: ASPickerDisplayItem.SetupOptions { get } ``` -------------------------------- ### Get and Set bluetoothNameSubstring Source: https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptor/bluetoothnamesubstring Use this property to access the accessory's over-the-air Bluetooth name substring. It can be read and written. ```swift var bluetoothNameSubstring: String? { get set } ``` -------------------------------- ### Access productImage Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/productimage Use this property to get an image of the accessory for display in the picker. Available on iOS 18.0+ and iPadOS 18.0+. ```swift @NSCopying var productImage: UIImage { get } ``` -------------------------------- ### Picker Event Cases for ASAccessoryEventType Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype Lists the various event types related to the accessory picker interface. These cases cover the presentation, dismissal, and different setup stages (bridging, pairing, renaming, failure) of the picker. ```swift case pickerDidPresent The discovery session picker appeared. ``` ```swift case pickerDidDismiss The discovery session picker dismissed. ``` ```swift case pickerSetupBridging The discovery session picker started bridging with an accessory. ``` ```swift case pickerSetupPairing The discovery session picker started pairing with a Bluetooth accessory. ``` ```swift case pickerSetupFailed The discovery session picker setup failed. ``` ```swift case pickerSetupRename The discovery session picker started renaming an accessory. ``` -------------------------------- ### Accessing Supported Options Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/supportoptions Demonstrates how to access the supported options for an accessory. ```APIDOC ## Accessing Supported Options ### See Also * Specifying options `var supportedOptions: ASAccessory.SupportOptions` Options supported by an accessory. ``` -------------------------------- ### ASAccessory.SupportOptions Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/supportoptions/bluetoothpairingle Documentation for the bluetoothPairingLE property and related Bluetooth support options in AccessorySetupKit. ```APIDOC ## Property: bluetoothPairingLE ### Description The accessory supports Bluetooth Low Energy pairing. ### Availability - iOS 18.0+ - iPadOS 18.0+ ### Declaration `static var bluetoothPairingLE: ASAccessory.SupportOptions { get }` ## Related Bluetooth Options ### bluetoothTransportBridging - Description: The accessory supports bridging to Bluetooth classic transport. - Declaration: `static var bluetoothTransportBridging: ASAccessory.SupportOptions` ### bluetoothHID - Description: The accessory supports Bluetooth Low Energy HID service. - Declaration: `static var bluetoothHID: ASAccessory.SupportOptions` ``` -------------------------------- ### Display an accessory picker Source: https://developer.apple.com/documentation/accessorysetupkit/discovering-and-configuring-accessories Create ASPickerDisplayItem instances with discovery descriptors and pass them to the session to show the system picker. ```swift private func showMyPicker() { var descriptor = ASDiscoveryDescriptor() descriptor.bluetoothServiceUUID = CBUUID(string: MY_ACCESSORY_UUID_STRING) // If using Wi-Fi, set descriptor.ssid instead. let displayName = "My Accessory" guard let productImage = UIImage(named: MY_ACCESSORY_IMAGE_NAME) else { return } var items: [ASPickerDisplayItem] = [] items.append (ASPickerDisplayItem(name: displayName, productImage: productImage, descriptor: descriptor)) // Create additional picker items if you support multiple accessories // with different Wi-Fi SSIDs or Bluetooth service UUIDs. session.showPicker(for: items) { error in if let error { // Handle error. } else { // Perform any post-picker cleanup. // If the picker finished by selecting an item, the event // handler receives it as an event of type `.accessoryAdded`. } } } ``` -------------------------------- ### Accessing the ssid property Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings/ssid Use this property to get or set the hotspot identifier for an accessory. ```swift var ssid: String? { get set } ``` -------------------------------- ### ASPickerDisplayItem Initialization Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem Initializes an ASPickerDisplayItem with a name, product image, and discovery descriptor. ```APIDOC ## `init(name: String, productImage: UIImage, descriptor: ASDiscoveryDescriptor)` ### Description Creates a picker display item with a name and image to display and a descriptor to match discovered accessories. ### Parameters #### Path Parameters - **name** (String) - Required - The accessory name to display in the picker. - **productImage** (UIImage) - Required - An image of the accessory to display in the picker. - **descriptor** (ASDiscoveryDescriptor) - Required - A descriptor that the picker uses to determine which discovered accessories to display. ``` -------------------------------- ### ASPickerDisplaySettings.DiscoveryTimeout Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/medium Documentation for the medium discovery timeout setting in AccessorySetupKit. ```APIDOC ## static let medium ### Description A picker discovery timeout value that times out after about two minutes. ### Availability - iOS 26.0+ - iPadOS 26.0+ - Mac Catalyst 26.0+ ### Declaration `static let medium: ASPickerDisplaySettings.DiscoveryTimeout` ``` -------------------------------- ### Initialize ASAccessory.SupportOptions with Raw Value Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/supportoptions/init%28rawvalue%3A%29 Use this initializer to create an ASAccessory.SupportOptions instance from a UInt raw value. Available for iOS 18.0+ and iPadOS 18.0+. ```swift init(rawValue: UInt) ``` -------------------------------- ### init(rawValue:) Source: https://developer.apple.com/documentation/accessorysetupkit/asbluetoothcompanyidentifier/init%28rawvalue%3A%29 Initializes an ASBluetoothCompanyIdentifier instance using a raw UInt16 value. ```APIDOC ## init(rawValue:) ### Description Creates an ASBluetoothCompanyIdentifier instance from a raw UInt16 value. ### Parameters #### Parameters - **rawValue** (UInt16) - Required - The raw identifier value. ### Request Example init(rawValue: 0x004C) ``` -------------------------------- ### finishPickerDiscovery(completionHandler:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/finishpickerdiscovery%28completionhandler%3A%29 Finishes the discovery session in the picker and displays a timeout error if no accessories were found. ```APIDOC ## finishPickerDiscovery(completionHandler:) ### Description Finish the discovery session in the picker and show a timeout error. Use this method if you previously set the picker display setting `discoveryTimeout` to `unbounded` in order to perform manual filtering of discovered accessories. ### Method Instance Method ### Parameters #### Parameters - **completionHandler** (closure) - Optional - A block or closure that executes after this operation completes. The completion handler receives an `NSError` instance if the operation encounters an error. ### Request Example ```swift func finishPickerDiscovery(completionHandler: @escaping @Sendable ((any Error)?) -> Void) ``` ### Response - **Error** (NSError) - Returns an error if the operation encounters an issue. ``` -------------------------------- ### showPicker(completionHandler:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/showpicker%28completionhandler%3A%29 Presents a picker that shows accessories managed by a Device Discovery Extension in your app. ```APIDOC ## showPicker(completionHandler:) ### Description Present a picker that shows accessories managed by a Device Discovery Extension in your app. Use this method when your app includes a DeviceDiscoveryExtension for its supported accessories. ### Method Instance Method ### Parameters #### completionHandler - **completionHandler** (closure) - Required - A block or closure that the picker calls when it completes the operation. The completion handler receives an NSError instance if the picker encounters an error. ### Request Example ```swift func showPicker(completionHandler: @escaping @Sendable ((any Error)?) -> Void) ``` ### Response - The session’s event handler receives events when this picker displays and dismisses, as well as when the person using the app picks an accessory. ``` -------------------------------- ### finishAuthorization(for:settings:completionHandler:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/finishauthorization%28for%3Asettings%3Acompletionhandler%3A%29 Completes the authorization process for a partially configured accessory. This is useful when an accessory has multiple network interfaces (e.g., Bluetooth and Wi-Fi) and requires additional information, like a full SSID, after initial onboarding. ```APIDOC ## finishAuthorization(for:settings:completionHandler:) ### Description Finish authorization of a partially-setup accessory. ### Method `func finishAuthorization(for accessory: ASAccessory, settings: ASAccessorySettings, completionHandler: @escaping @Sendable ((any Error)?) -> Void) ` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None explicitly defined, completion handler is called with no error. #### Response Example None ``` -------------------------------- ### ASPickerDisplaySettings.DiscoveryTimeout.short Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/short Defines the short discovery timeout setting for AccessorySetupKit pickers. ```APIDOC ## static let short ### Description A picker discovery timeout value that times out after about 60 seconds. ### Availability - iOS 26.0+ - iPadOS 26.0+ - Mac Catalyst 26.0+ ### Declaration `static let short: ASPickerDisplaySettings.DiscoveryTimeout` ``` -------------------------------- ### Accessory States - Unauthorized Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/accessorystate Represents an accessory that is invalid or not authorized for use. This state indicates a problem with the accessory's credentials or setup. ```swift case unauthorized ``` -------------------------------- ### showPicker(for:completionHandler:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/showpicker%28for%3Acompletionhandler%3A%29 Presents a picker that shows discovered accessories matching an array of display items. ```APIDOC ## showPicker(for:completionHandler:) ### Description Present a picker that shows discovered accessories matching an array of display items. ### Parameters #### Parameters - **displayItems** ([ASPickerDisplayItem]) - Required - An array of ASPickerDisplayItem instances describing accessories your app can set up. - **completionHandler** (@escaping @Sendable ((any Error)?) -> Void) - Optional - A block or closure that the picker calls when it completes the operation. ### Request Example func showPicker( for displayItems: [ASPickerDisplayItem], completionHandler: @escaping @Sendable ((any Error)?) -> Void ) ### Response #### Success Response - **completionHandler** (Error?) - Returns an NSError instance if the picker encounters an error. ``` -------------------------------- ### ASBluetoothCompanyIdentifier init(_:) Source: https://developer.apple.com/documentation/accessorysetupkit/asbluetoothcompanyidentifier/init%28_%3A%29 Initializes an ASBluetoothCompanyIdentifier with a raw 16-bit unsigned integer value. ```APIDOC ## init(_:) ### Description Initializes a new ASBluetoothCompanyIdentifier instance using a raw 16-bit unsigned integer value. ### Method Initializer ### Parameters #### Parameters - **rawValue** (UInt16) - Required - The raw 16-bit unsigned integer value for the identifier. ### Request Example init(0x004C) ``` -------------------------------- ### Configure Picker Discovery Settings Source: https://developer.apple.com/documentation/accessorysetupkit/discovering-and-configuring-accessories Set the picker display settings to enable custom filtering and an unbounded discovery timeout. ```swift let settings = ASPickerDisplaySettings.default settings.discoveryTimeout = .unbounded settings.options.insert(.filterDiscoveryResults) session.pickerDisplaySettings = settings ``` -------------------------------- ### Present Accessory Picker (Deprecated/Alternative) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/showpicker%28for%3Acompletionhandler%3A%29 Presents a picker for accessories managed by a Device Discovery Extension. This method may be an alternative or older version compared to the `showPicker(for:completionHandler:)`. ```swift func showPicker(completionHandler: ((any Error)?) -> Void) ``` -------------------------------- ### Accessing the Default Accessory Settings Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings/default Use this class property to get an empty settings object. Available for iOS 18.0+ and iPadOS 18.0+. ```swift class var `default`: ASAccessorySettings { get } ``` -------------------------------- ### Access renameOptions property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/renameoptions Defines the renaming options for an accessory. Include rename in setupOptions to enable this functionality. ```swift var renameOptions: ASAccessory.RenameOptions { get set } ``` -------------------------------- ### Define SupportOptions Structure Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/supportoptions This is the basic structure definition for SupportOptions. ```swift struct SupportOptions ``` -------------------------------- ### Get Accessory Hotspot Identifier Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings Accesses the SSID for an accessory's Wi-Fi hotspot. Clients can use this string to connect to the accessory's network. ```swift var ssid: String? ``` -------------------------------- ### Get Accessory Event Type Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryevent/eventtype Retrieve the type of event that occurred, such as accessory addition or removal. This property is available on iOS 18.0+ and iPadOS 18.0+. ```swift var eventType: ASAccessoryEventType { get } ``` -------------------------------- ### Finish Accessory Authorization (Completion Handler) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/finishauthorization%28for%3Asettings%3Acompletionhandler%3A%29 Use this method when an accessory has multiple wireless interfaces and requires full SSID information after initial onboarding. This variant uses a completion handler. ```swift func finishAuthorization( for accessory: ASAccessory, settings: ASAccessorySettings, completionHandler: @escaping @Sendable ((any Error)?) -> Void ) ``` -------------------------------- ### renameAccessory(_:options:completionHandler:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/renameaccessory%28_%3Aoptions%3Acompletionhandler%3A%29 Displays a system view to rename an accessory, with support for specific rename options. ```APIDOC ## renameAccessory(_:options:completionHandler:) ### Description Displays a view to rename an accessory. To rename a Wi-Fi SSID, use the `ssid` option. ### Parameters #### Path Parameters - **accessory** (ASAccessory) - Required - The accessory to rename. - **renameOptions** (ASAccessory.RenameOptions) - Optional - Options that affect the behavior of the rename operation. - **completionHandler** (Closure) - Optional - A block or closure that executes after the rename operation completes. Receives an NSError if an error occurs. ### Request Example ```swift func renameAccessory( _ accessory: ASAccessory, options renameOptions: ASAccessory.RenameOptions = [], completionHandler: @escaping @Sendable ((any Error)?) -> Void ) ``` ### Response #### Success Response - **completionHandler** (Error?) - Returns nil on success, or an NSError if the operation encounters an error. ``` -------------------------------- ### Define ASAccessoryEventType Enumeration Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype Defines the ASAccessoryEventType enumeration for various accessory events. Use this enumeration to identify and handle different occurrences during accessory setup and management. ```swift enum ASAccessoryEventType ``` -------------------------------- ### Get Bluetooth Transport Bridging Identifier Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings Retrieves a 6-byte identifier used for bridging classic transport profiles. This is essential for establishing specific Bluetooth connections. ```swift var bluetoothTransportBridgingIdentifier: Data? ``` -------------------------------- ### Inspecting Accessory Settings Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings/ssid Related method for inspecting accessory settings. ```APIDOC ## See Also ### Inspecting accessory settings `var bluetoothTransportBridgingIdentifier: Data?` A 6-byte identifier for bridging classic transport profiles. ``` -------------------------------- ### Displaying an accessory picker Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession Methods for presenting the accessory picker to the user. ```APIDOC ## Displaying an accessory picker ### `showPicker(completionHandler: ((any Error)?) -> Void)` Present a picker that shows accessories managed by a Device Discovery Extension in your app. ### `showPicker(for: [ASPickerDisplayItem], completionHandler: ((any Error)?) -> Void)` Present a picker that shows discovered accessories matching an array of display items. ``` -------------------------------- ### Get Accessory Bluetooth Company Identifier Source: https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptor/bluetoothcompanyidentifier Retrieve the accessory's 16-bit Bluetooth Company Identifier. This property is available in iOS 18.0+ and iPadOS 18.0+. ```swift var bluetoothCompanyIdentifier: ASBluetoothCompanyIdentifier { get set } ``` -------------------------------- ### ASPickerDisplaySettings.DiscoveryTimeout.long Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/long The 'long' property defines a discovery timeout value that lasts approximately five minutes. It is available on iOS, iPadOS, and Mac Catalyst starting from version 26.0. ```APIDOC ## ASPickerDisplaySettings.DiscoveryTimeout.long ### Description A picker discovery timeout value that times out after about five minutes. ### Availability iOS 26.0+ iPadOS 26.0+ Mac Catalyst 26.0+ ### Property Declaration ```swift static let long: ASPickerDisplaySettings.DiscoveryTimeout ``` ### See Also - `ASPickerDisplaySettings.default`: An empty settings object. - `ASPickerDisplaySettings.short`: A picker discovery timeout value that times out after about about 60 seconds. - `ASPickerDisplaySettings.medium`: A picker discovery timeout value that times out after about two minutes. - `ASPickerDisplaySettings.unbounded`: A picker discovery that only times out when the app tells it to. ``` -------------------------------- ### ASPickerDisplaySettings.DiscoveryTimeout.unbounded Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/short Use this static property for a picker discovery that only times out when explicitly told to by the app. This setting is available on iOS, iPadOS, and Mac Catalyst starting from version 26.0. ```swift static let unbounded: ASPickerDisplaySettings.DiscoveryTimeout ``` -------------------------------- ### Handle Accessory Discovery Events Source: https://developer.apple.com/documentation/accessorysetupkit/discovering-and-configuring-accessories Inspect discovered accessories and update the picker with customized display items. ```swift session.activate(on: .main) { [weak self] event in guard let strongSelf = self else { return } switch event.eventType { case .accessoryDiscovered: if let accessory = event.accessory as? ASDiscoveredAccessory { if myShouldDisplayAccessory(advertisement: accessory.bluetoothAdvertisementData, rssi: accessory.bluetoothRSSI) { let item = ASDiscoveredDisplayItem(name: "More Specific Product Name", productImage: UIImage(named: "AssetPreparedJustInTime")!, accessory: accessory) session.updatePicker(showing: [item]) { error in print(error) } } } } } ``` -------------------------------- ### updateAuthorization(for:descriptor:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/updateauthorization%28for%3Adescriptor%3Acompletionhandler%3A%29 Displays a view to upgrade an accessory with additional technology permissions. This is the asynchronous, throwing version. ```APIDOC ## updateAuthorization(for:descriptor:) ### Description Displays a view to upgrade an accessory with additional technology permissions using an asynchronous approach. ### Method func ### Endpoint N/A (Instance Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters - **accessory** (ASAccessory) - Required - The accessory to update. - **descriptor** (ASDiscoveryDescriptor) - Required - An updated descriptor that the picker uses to add new technology authorization for the provided accessory. ### Discussion In Swift, you can omit the completion handler by calling the method asynchronously and catching any error thrown by the method. ``` -------------------------------- ### Accessory Bluetooth Service Data Mask Source: https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptor/bluetoothservicedatamask Use this property to get or set the accessory's Bluetooth service data mask. Available on iOS 18.0+ and iPadOS 18.0+. ```swift var bluetoothServiceDataMask: Data? { get set } ``` -------------------------------- ### Finish Accessory Authorization Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings Completes the authorization process for a partially set up accessory. Requires the accessory object, its settings, and a completion handler. ```swift func finishAuthorization(for: ASAccessory, settings: ASAccessorySettings, completionHandler: ((any Error)?) -> Void) ``` -------------------------------- ### ASPickerDisplaySettings.DiscoveryTimeout.long Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/short Use this static property to set a picker discovery timeout to approximately five minutes. This setting is available on iOS, iPadOS, and Mac Catalyst starting from version 26.0. ```swift static let long: ASPickerDisplaySettings.DiscoveryTimeout ``` -------------------------------- ### Managing accessories Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession Methods for renaming and removing accessories. ```APIDOC ## Managing accessories ### `renameAccessory(ASAccessory, options: ASAccessory.RenameOptions, completionHandler: ((any Error)?) -> Void)` Displays a view to rename an accessory. ### `struct RenameOptions` Options that affect the behavior of an accessory renaming operation. ### `removeAccessory(ASAccessory, completionHandler: ((any Error)?) -> Void)` Removes an accessory. ``` -------------------------------- ### ASPickerDisplaySettings.DiscoveryTimeout.short Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/short Use this static property to set a picker discovery timeout to approximately 60 seconds. This setting is available on iOS, iPadOS, and Mac Catalyst starting from version 26.0. ```swift static let short: ASPickerDisplaySettings.DiscoveryTimeout ``` -------------------------------- ### bluetoothServiceDataMask Property Source: https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptor/bluetoothservicedatamask The bluetoothServiceDataMask property is an instance property of the AccessorySetupKit that allows you to get and set the accessory's Bluetooth service data mask. It is available on iOS 18.0+ and iPadOS 18.0+. ```APIDOC ## Instance Property: bluetoothServiceDataMask ### Description The accessory’s Bluetooth service data mask. ### Availability iOS 18.0+ iPadOS 18.0+ ### Syntax ```swift var bluetoothServiceDataMask: Data? { get set } ``` ### See Also - `bluetoothCompanyIdentifier`: The accessory’s 16-bit Bluetooth Company Identifier. - `ASBluetoothCompanyIdentifier`: The type used to identify a Bluetooth accessory provider. - `bluetoothManufacturerDataBlob`: A byte buffer that matches the accessory’s Bluetooth manufacturer data. - `bluetoothManufacturerDataMask`: The accessory’s Bluetooth manufacturer data mask. - `bluetoothServiceDataBlob`: A byte buffer that matches the accessory’s Bluetooth service data. - `bluetoothNameSubstring`: The accessory’s over-the-air Bluetooth name substring. - `bluetoothNameSubstringCompareOptions`: The accessory’s over-the-air Bluetooth name substring compare options. - `bluetoothServiceUUID`: The accessory’s Bluetooth service UUID. - `bluetoothRange`: A property that tells the session to discover accessories within a specific Bluetooth range. - `Range`: The Bluetooth range in which to discover accessories. ``` -------------------------------- ### ASAccessory.SupportOptions Structure Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/supportoptions Defines options for discoverable accessories, available from iOS 18.0 and iPadOS 18.0 onwards. ```APIDOC ## ASAccessory.SupportOptions Options of discoverable accessories. iOS 18.0+iPadOS 18.0+ ```swift struct SupportOptions ``` ### Creating an options instance `init(rawValue: UInt)` ### Bluetooth options `static var bluetoothPairingLE: ASAccessory.SupportOptions` The accessory supports Bluetooth Low Energy pairing. `static var bluetoothTransportBridging: ASAccessory.SupportOptions` The accessory supports bridging to Bluetooth classic transport. `static var bluetoothHID: ASAccessory.SupportOptions` The accessory supports Bluetooth Low Energy HID service. ### Conforms To * `BitwiseCopyable` * `Equatable` * `ExpressibleByArrayLiteral` * `OptionSet` * `RawRepresentable` * `Sendable` * `SendableMetatype` * `SetAlgebra` ``` -------------------------------- ### Instance Property: productImage Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/productimage An image of the accessory to display in the picker. Available on iOS 18.0+ and iPadOS 18.0+. ```APIDOC ## Instance Property: productImage ### Description An image of the accessory to display in the picker. ### Availability iOS 18.0+ iPadOS 18.0+ ### Declaration ```swift @NSCopying var productImage: UIImage { get } ``` ### See Also * [Customizing display properties](doc:customizing-display-properties) * `var name: String` ``` -------------------------------- ### Activate AccessorySetupKit Session Source: https://developer.apple.com/documentation/accessorysetupkit/discovering-and-configuring-accessories Create and activate an ASAccessorySession to receive callbacks for accessory discovery events. The event handler processes various event types, such as accessory addition, removal, or session invalidation. Ensure the session is activated on a DispatchQueue, defaulting to main. ```swift let session = ASAccessorySession() override func viewDidLoad() { super.viewDidLoad() session.activate(on: DispatchQueue.main) { [weak self] event in guard let self else { return } switch event.eventType { case .activated: // Use previously-discovered accessories in // session.accessories, if necessary. case .accessoryAdded: // Handle addition of an accessory by person using the app. case .accessoryRemoved, .accessoryChanged: // Handle removal or change of previously-added // accessory, if necessary. case .invalidated: // The session is now invalid and you can't use it further. case .migrationComplete: // Handle migration. case .pickerDidPresent: // Update state for picker appearing, if necessary. case .pickerDidDismiss: // Update state for picker disappearing, if necessary. case .unknown: // Handle unknown event type, if appropriate. @unknown default: // Reserve this space for yet-to-be-defined event types. } } } ``` -------------------------------- ### Present Accessory Picker with Completion Handler Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/showpicker%28for%3Acompletionhandler%3A%29 Use this method to present a picker that displays discovered accessories matching the provided `ASPickerDisplayItem` array. The completion handler is called upon operation completion, receiving an `Error` if one occurred. ```swift func showPicker( for displayItems: [ASPickerDisplayItem], completionHandler: @escaping @Sendable ((any Error)?) -> Void ) ``` -------------------------------- ### Connect to Selected Accessory Source: https://developer.apple.com/documentation/accessorysetupkit/discovering-and-configuring-accessories Retrieve accessory identifiers to initiate communication via Core Bluetooth or Network Extension. ```swift private func handleAccessoryAdded(_ accessory: ASAccessory) { if let btIdentifier = accessory.bluetoothIdentifier { // Use Core Bluetooth to communicate with and configure the accessory. } else if let ssid = accessory.ssid { // Create a `NEHotspotConfiguration` with this SSID to configure. } } ``` -------------------------------- ### updateAuthorization(for:descriptor:completionHandler:) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/updateauthorization%28for%3Adescriptor%3Acompletionhandler%3A%29 Displays a view to upgrade an accessory with additional technology permissions. This is the completion handler-based version. ```APIDOC ## updateAuthorization(for:descriptor:completionHandler:) ### Description Displays a view to upgrade an accessory with additional technology permissions. ### Method func ### Endpoint N/A (Instance Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters - **accessory** (ASAccessory) - Required - The accessory to update. - **descriptor** (ASDiscoveryDescriptor) - Required - An updated descriptor that the picker uses to add new technology authorization for the provided accessory. - **completionHandler** (@escaping @Sendable ((any Error)?) -> Void) - Required - A block or closure that executes after the picker is shown. The completion handler receives an `NSError` instance if the upgrade operation encounters an error. ``` -------------------------------- ### Initialize ASPickerDisplaySettings.DiscoveryTimeout Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/init%28rawvalue%3A%29 Use this initializer to set the discovery timeout value. Available on iOS 26.0+ and iPadOS 26.0+. ```swift init(rawValue: TimeInterval) ``` -------------------------------- ### ASPickerDisplaySettings Initializer Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/init%28rawvalue%3A%29 Initializes an ASPickerDisplaySettings object with a raw time interval value. ```APIDOC ## init(rawValue:) ### Description Initializes an `ASPickerDisplaySettings` object with a raw time interval value. ### Method `init(rawValue: TimeInterval)` ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None (Initializer) #### Response Example None ``` -------------------------------- ### ASAccessory.AccessoryState Enumeration Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/accessorystate Defines the possible authorization states for an accessory within the AccessorySetupKit framework. ```APIDOC ## ASAccessory.AccessoryState ### Description An enumeration of possible authorization states of an accessory. ### Availability - iOS 18.0+ - iPadOS 18.0+ ### Cases - **unauthorized**: The accessory is invalid or unauthorized. - **awaitingAuthorization**: The accessory is selected, but full authorization is still pending. - **authorized**: The accessory is authorized and available. ### Initializers - **init?(rawValue: Int)**: Creates a state instance from a raw integer value. ### Relationships - **Conforms To**: BitwiseCopyable, Equatable, Hashable, RawRepresentable, Sendable, SendableMetatype ``` -------------------------------- ### ASPickerDisplaySettings Class Reference Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings Overview of the ASPickerDisplaySettings class, including its properties for discovery timeout and picker options. ```APIDOC ## ASPickerDisplaySettings ### Description A type that contains settings to customize the display of the accessory picker. ### Properties - **default** (class var) - An empty settings object. - **discoveryTimeout** (var) - Custom timeout for picker. Default is 30 seconds. Type: ASPickerDisplaySettings.DiscoveryTimeout. - **options** (var) - Custom options for the picker. Type: ASPickerDisplaySettings.Options. ### Relationships - **Inherits From**: NSObject - **Conforms To**: CVarArg, CustomDebugStringConvertible, CustomStringConvertible, Equatable, Hashable, NSObjectProtocol, Sendable, SendableMetatype ``` -------------------------------- ### Accessory Authorization Methods Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings Methods for managing the authorization lifecycle of accessories. ```APIDOC ## Accessory Authorization Methods ### Methods - **finishAuthorization(for:settings:completionHandler:)** - Finish authorization of a partially-setup accessory. - **failAuthorization(for:completionHandler:)** - End authorization of a partially-configured accessory as a failure. - **updateAuthorization(for:descriptor:completionHandler:)** - Displays a view to upgrade an accessory with additional technology permissions. ``` -------------------------------- ### Finish Accessory Authorization (Async/Await) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/finishauthorization%28for%3Asettings%3Acompletionhandler%3A%29 This asynchronous variant of `finishAuthorization` is suitable for modern Swift development, handling accessory authorization completion without explicit completion handlers. ```swift func finishAuthorization( for accessory: ASAccessory, settings: ASAccessorySettings ) async throws ``` -------------------------------- ### Customizing the discovery timeout Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct Information on how to customize the discovery timeout for the accessory picker. ```APIDOC ## Customizing the discovery timeout ### `discoveryTimeout` Property - **Type**: `ASPickerDisplaySettings.DiscoveryTimeout` - **Description**: Custom timeout for picker. Default is 30 seconds. This property allows you to set a custom discovery timeout value for the accessory picker. The default value is 30 seconds. ``` -------------------------------- ### Managing authorization Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession Methods for managing accessory authorization and settings. ```APIDOC ## Managing authorization ### `finishAuthorization(for: ASAccessory, settings: ASAccessorySettings, completionHandler: ((any Error)?) -> Void)` Finish authorization of a partially-setup accessory. ### `class ASAccessorySettings` Properties of an accessory. ### `failAuthorization(for: ASAccessory, completionHandler: ((any Error)?) -> Void)` End authorization of a partially-configured accessory as a failure. ### `updateAuthorization(for: ASAccessory, descriptor: ASDiscoveryDescriptor, completionHandler: ((any Error)?) -> Void)` Displays a view to upgrade an accessory with additional technology permissions. ``` -------------------------------- ### ASPickerDisplaySettings.options Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/options-swift.property Accesses or modifies the custom options for the accessory picker. ```APIDOC ## Property: ASPickerDisplaySettings.options ### Description Custom options for the accessory picker. ### Availability - iOS 26.1+ - iPadOS 26.1+ ### Declaration `var options: ASPickerDisplaySettings.Options { get set }` ``` -------------------------------- ### Rename an accessory using AccessorySetupKit Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/renameaccessory%28_%3Aoptions%3Acompletionhandler%3A%29 Provides two variants for renaming an accessory: one using a completion handler and one using Swift concurrency. ```swift func renameAccessory( _ accessory: ASAccessory, options renameOptions: ASAccessory.RenameOptions = [], completionHandler: @escaping @Sendable ((any Error)?) -> Void ) ``` ```swift func renameAccessory( _ accessory: ASAccessory, options renameOptions: ASAccessory.RenameOptions = [] ) async throws ``` -------------------------------- ### ASAccessory Initializer Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/supportoptions/init%28rawvalue%3A%29 Initializes an instance of ASAccessory with a raw value. This initializer is available on iOS 18.0+ and iPadOS 18.0+. ```APIDOC ## Initializer: init(rawValue:) ### Description Initializes an instance of ASAccessory with a raw unsigned integer value. ### Method `init(rawValue: UInt)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### Availability iOS 18.0+ iPadOS 18.0+ ``` -------------------------------- ### finishAuthorization(for:settings:) - Async Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/finishauthorization%28for%3Asettings%3Acompletionhandler%3A%29 An asynchronous version of the finishAuthorization method, suitable for use in Swift concurrency contexts. It throws an error if authorization fails. ```APIDOC ## finishAuthorization(for:settings:) ### Description Finish authorization of a partially-setup accessory using async/await. ### Method `func finishAuthorization(for accessory: ASAccessory, settings: ASAccessorySettings) async throws ` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None explicitly defined, the function returns upon successful completion. #### Response Example None ``` -------------------------------- ### Update Picker with Async/Await Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/updatepicker%28showing%3Acompletionhandler%3A%29 Use this method to update the picker with app-filtered accessories using the async/await syntax. This method throws an error if the operation fails. ```swift func updatePicker(showing displayItems: [ASDiscoveredDisplayItem]) async throws ``` -------------------------------- ### Initialize AccessoryState from raw value Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/accessorystate/init%28rawvalue%3A%29 Creates an instance of AccessoryState using the provided raw integer value. Returns nil if the value does not correspond to a valid state. ```swift init?(rawValue: Int) ``` -------------------------------- ### ASAccessory.AccessoryState.awaitingAuthorization Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/accessorystate/awaitingauthorization Represents the state where an accessory has been selected by the user but requires further authorization to be fully available. ```APIDOC ## ASAccessory.AccessoryState.awaitingAuthorization ### Description The accessory is selected, but full authorization is still pending. ### Availability - iOS 18.0+ - iPadOS 18.0+ ### Definition ```swift case awaitingAuthorization ``` ``` -------------------------------- ### ASPickerDisplaySettings.default Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/discoverytimeout-swift.struct/short Provides an empty settings object for ASPickerDisplaySettings. This is useful for initializing settings without specific configurations. ```swift class var `default`: ASPickerDisplaySettings ``` -------------------------------- ### ASAccessory.AccessoryState Initializer Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/accessorystate/init%28rawvalue%3A%29 Initializes a new instance of ASAccessory.AccessoryState with a raw integer value. This initializer is available on iOS 18.0+ and iPadOS 18.0+. ```APIDOC ## ASAccessory.AccessoryState init(rawValue:) ### Description Initializes a new instance of `ASAccessory.AccessoryState` with a raw integer value. ### Method `init?(rawValue: Int)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### Availability iOS 18.0+ iPadOS 18.0+ ``` -------------------------------- ### Initialize ASBluetoothCompanyIdentifier Source: https://developer.apple.com/documentation/accessorysetupkit/asbluetoothcompanyidentifier/init%28_%3A%29 Creates a new identifier instance from a 16-bit unsigned integer. ```swift init(_ rawValue: UInt16) ``` -------------------------------- ### ASAccessorySettings.default Property Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings/default Retrieves the default settings object for AccessorySetupKit. ```APIDOC ## GET ASAccessorySettings.default ### Description Returns an empty settings object for the AccessorySetupKit framework. ### Availability - iOS 18.0+ - iPadOS 18.0+ ### Property Definition `class var default: ASAccessorySettings { get }` ``` -------------------------------- ### Instance Property: displayName Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/displayname The `displayName` property returns the accessory's name, formatted for user display within an application. ```APIDOC ## Instance Property: displayName ### Description The accessory’s name, suitable for displaying to someone using your app. ### Availability iOS 18.0+ iPadOS 18.0+ ### Declaration ```swift var displayName: String { get } ``` ### Mentioned in Discovering and configuring accessories ``` -------------------------------- ### ASAccessory.descriptor Property Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessory/descriptor Retrieves the discovery descriptor associated with an accessory instance. ```APIDOC ## Property: descriptor ### Description The descriptor used to discover the accessory. ### Availability - iOS 18.0+ - iPadOS 18.0+ ### Declaration ```swift @NSCopying var descriptor: ASDiscoveryDescriptor { get } ``` ``` -------------------------------- ### Present Accessory Picker with Completion Handler Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/showpicker%28completionhandler%3A%29 Use this method when your app includes a DeviceDiscoveryExtension for its supported accessories. The completion handler receives an `NSError` instance if the picker encounters an error. ```swift func showPicker(completionHandler: @escaping @Sendable ((any Error)?) -> Void) ``` -------------------------------- ### Present Accessory Picker Asynchronously Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/showpicker%28completionhandler%3A%29 This is an asynchronous version of the `showPicker` method. It is suitable for use in `async/await` contexts. ```swift func showPicker() async throws ``` -------------------------------- ### Define pickerSetupBridging event case Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessoryeventtype/pickersetupbridging Represents the event where the discovery session picker begins the bridging process with an accessory. ```swift case pickerSetupBridging ``` -------------------------------- ### Initialize ASBluetoothCompanyIdentifier with raw value Source: https://developer.apple.com/documentation/accessorysetupkit/asbluetoothcompanyidentifier/init%28rawvalue%3A%29 Creates an instance of ASBluetoothCompanyIdentifier using a 16-bit unsigned integer. ```swift init(rawValue: UInt16) ``` -------------------------------- ### name Property Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem/name The accessory name to display in the picker. ```APIDOC ## name Property ### Description The accessory name to display in the picker. ### Availability iOS 18.0+ iPadOS 18.0+ ### Syntax ```swift var name: String { get } ``` ``` -------------------------------- ### Update Accessory Authorization (Async/Await) Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysession/updateauthorization%28for%3Adescriptor%3Acompletionhandler%3A%29 This asynchronous version of `updateAuthorization` allows you to update an accessory without a completion handler. Errors are thrown and can be caught using Swift's `try-catch` mechanism. ```swift func updateAuthorization( for accessory: ASAccessory, descriptor: ASDiscoveryDescriptor ) async throws ``` -------------------------------- ### ASPickerDisplaySettings.default Source: https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplaysettings/default Retrieves the default settings object for the picker display. ```APIDOC ## GET ASPickerDisplaySettings.default ### Description Returns an empty settings object for the picker display. ### Availability - iOS 26.0+ - iPadOS 26.0+ ### Declaration `class var default: ASPickerDisplaySettings { get }` ``` -------------------------------- ### Update Accessory Authorization Source: https://developer.apple.com/documentation/accessorysetupkit/asaccessorysettings Initiates a view to upgrade an accessory's technology permissions. Requires the accessory, a discovery descriptor, and a completion handler. ```swift func updateAuthorization(for: ASAccessory, descriptor: ASDiscoveryDescriptor, completionHandler: ((any Error)?) -> Void) ```