Community-maintained Agent Skills for complete Swift and Apple-platform app delivery.
72
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Medium
Suggest reviewing before use
Discover and pair Bluetooth and Wi-Fi accessories with privacy-preserving iOS 18+ system pickers. ASAccessorySession eliminates the need for broad system Bluetooth authorization prompts. After user authorization, hand off communication to CoreBluetooth or NetworkExtension.
Add matching configuration keys to Info.plist:
| Key | Type | Purpose |
|---|---|---|
NSAccessorySetupSupports | [String] | Required. Contains Bluetooth and/or WiFi |
NSAccessorySetupBluetoothServices | [String] | Service UUIDs discovered by the app |
NSAccessorySetupBluetoothNames | [String] | Accessory name substrings to match |
NSAccessorySetupBluetoothCompanyIdentifiers | [String] | Two-byte Bluetooth company identifiers |
The Bluetooth-specific Info.plist values must strictly match the rules in ASDiscoveryDescriptor. If an accessory matches a descriptor not declared in Info.plist, the app crashes at runtime.
No user Bluetooth permission prompt is triggered; CBCentralManager transitions to poweredOn once at least one accessory is authorized via AccessorySetupKit.
Define matching criteria for scanning nearby hardware:
import AccessorySetupKit
import CoreBluetooth
// Bluetooth Descriptor
var btDescriptor = ASDiscoveryDescriptor()
btDescriptor.bluetoothServiceUUID = CBUUID(string: "12345678-1234-1234-1234-123456789ABC")
btDescriptor.bluetoothNameSubstring = "SmartSensor"
btDescriptor.bluetoothRange = .immediate // Only nearby devices
// Wi-Fi Descriptor (provide either ssid OR ssidPrefix, not both)
var wifiDescriptor = ASDiscoveryDescriptor()
wifiDescriptor.ssidPrefix = "SmartSensor-"Activate an ASAccessorySession and present the system picker:
import AccessorySetupKit
final class AccessoryCoordinator {
let session = ASAccessorySession()
func start() {
session.activate(on: .main) { [weak self] event in
switch event.eventType {
case .accessoryAdded, .accessoryChanged:
if let accessory = event.accessory {
self?.handleAuthorizedAccessory(accessory)
}
case .accessoryRemoved:
self?.handleRemovedAccessory(event.accessory)
case .sessionReset:
self?.session.activate(on: .main, eventHandler: { _ in })
@unknown default:
break
}
}
}
func presentPicker(descriptor: ASDiscoveryDescriptor) {
let displayItem = ASPickerDisplayItem(
name: "Smart Sensor",
productImage: UIImage(named: "sensor")!,
descriptor: descriptor
)
session.showPicker(for: [displayItem]) { error in
if let error { print("Picker failed: \(error)") }
}
}
}After the user selects an accessory in the system picker:
CBCentralManager.retrievePeripherals(withIdentifiers: [accessory.bluetoothIdentifier]). Do not run general scans.NEHotspotConfigurationManager).ASDiscoveryDescriptor must be declared in Info.plist or the app crashes.ssid or ssidPrefix, never both.scanForPeripherals(); retrieve authorized peripherals by identifier..sessionReset: The system can invalidate sessions during daemon restarts; recreate or reactivate the session upon .sessionReset.NSAccessorySetupSupports declared in Info.plist with Bluetooth / WiFissid or ssidPrefix, not bothretrievePeripherals(withIdentifiers:) without scanning.accessoryAdded, .accessoryRemoved, and .sessionReset.tessl-plugin
skills
accessorysetupkit
references
activitykit
adattributionkit
references
alarmkit
references
app-clips
app-intents
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
audioaccessorykit
references
authentication
references
avfoundation-audio
references
avkit
background-processing
references
browserenginekit
callkit
references
carplay
cloudkit
contacts-framework
references
core-bluetooth
references
core-data
core-haptics
references
core-motion
references
core-nfc
references
coreml
references
cryptokit
cryptotokenkit
debugging-instruments
device-integrity
references
energykit
references
eventkit
family-controls
references
financekit
focus-engine
gamekit
git-branching-workflow
references
healthkit
references
homekit
references
ios-accessibility
ios-app-workflow
references
ios-ettrace-performance
ios-localization
ios-memgraph-analysis
ios-networking
ios-simulator
references
metrickit
references
musickit
references
natural-language
paperkit
references
passkit
references
pdfkit
pencilkit
references
permissionkit
references
photokit
push-notifications
quicklook
references
realitykit
references
relevancekit
references
scenekit
sensorkit
shazamkit
references
speech-recognition
references
spritekit
storekit
swift-api-design-guidelines
swift-architecture
references
swift-charts
swift-codable
references
swift-code-review
swift-concurrency
swift-formatstyle
references
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-responsive-layout
swiftui-uikit-interop
swiftui-webkit
tabletopkit
tipkit
vision-framework
weatherkit
references