accessory-setup-kit
AccessorySetupKit
What to open
- Use
accessory-setup-kit/accessorysetupkit.mdfor all API details and key names. - Use
accessory-setup-kit/AccessorySetupKitEverythingBLEDevelopersNeedToKnow.mdfor BLE-specific behavior notes and real-world details. - Search within it for: "Discovering and configuring accessories",
ASAccessorySession,ASDiscoveryDescriptor,ASPickerDisplayItem,ASMigrationDisplayItem,ASPickerDisplaySettings, andASAccessoryEventType.
Workflow
- Identify whether the accessory uses Bluetooth, Wi-Fi, or Wi-Fi Aware and set up matching discovery properties.
- Declare required Info.plist keys for AccessorySetupKit and any Bluetooth identifiers.
- Create and activate
ASAccessorySession, then handle events on the provided queue. - Present a picker with
ASPickerDisplayItemitems that match the accessories you support. - Handle
.accessoryAddedto connect to the selected device; handle.accessoryRemovedand.accessoryChangedas needed.
Picker guidance
- A display item must include a descriptor with a Bluetooth identifier or Wi-Fi SSID/SSID prefix.
- For Bluetooth filters, provide at least a service UUID or company identifier, and optionally a name substring or manufacturer/service data mask pair.
- To do custom filtering, enable
filterDiscoveryResultsand handle.accessoryDiscoveredby creatingASDiscoveredDisplayItementries, then callupdatePicker(showing:completionHandler:). - If custom filtering needs unlimited time, set
discoveryTimeout = .unboundedand finish discovery withfinishPickerDiscovery(completionHandler:).
Migration and post-setup
- Use
ASMigrationDisplayItemto migrate previously-configured accessories into AccessorySetupKit. - Use setup and rename options on picker items when the user should rename or finish setup in-app.
Reminders
- Keep discovery descriptors specific to avoid broad Bluetooth access.
- For Wi-Fi Aware, set Wi-Fi Aware properties on
ASDiscoveryDescriptorbefore discovery. - Use the session event stream to keep app state in sync with user actions.
More from nonameplum/agent-skills
corebluetooth
Apple Core Bluetooth framework for BLE and Bluetooth Classic. Use for central/peripheral workflows, scanning, connecting, advertising, GATT services/characteristics, read/write/notify, L2CAP, background processing or state restoration, and error handling across Apple platforms.
42swift-package-manager
Swift Package Manager documentation - create packages, manage dependencies, build and test Swift code
32swift-health-kit
Apple HealthKit framework for health and fitness data. Use for reading/writing health samples, workout data, authorization flows, observer queries, background delivery, clinical records, activity rings, and integrating with the Health app across iPhone, Apple Watch, iPad, and visionOS.
30swift-composable-architecture
The Composable Architecture (TCA) - A library for building Swift applications with state management, composition, and testability
29swift-dependencies
A dependency management library for Swift with controlled, testable dependencies
26swift-docc
Official Swift DocC documentation markup and syntax reference
23