diff --git a/Sources/SpeziBluetooth/AccessorySetupKit/AccessorySetupKit.swift b/Sources/SpeziBluetooth/AccessorySetupKit/AccessorySetupKit.swift index c699214..fb00981 100644 --- a/Sources/SpeziBluetooth/AccessorySetupKit/AccessorySetupKit.swift +++ b/Sources/SpeziBluetooth/AccessorySetupKit/AccessorySetupKit.swift @@ -152,9 +152,11 @@ public final class AccessorySetupKit { } nonisolated func cancelHandler(for id: UUID) { +#if canImport(AccessorySetupKit) && !targetEnvironment(macCatalyst) && !os(macOS) subscriptionLock.withLock { _ = accessoryChangeHandlers.removeValue(forKey: id) } +#endif } #if canImport(AccessorySetupKit) && !targetEnvironment(macCatalyst) && !os(macOS) diff --git a/Sources/TestPeripheral/TestPeripheral.swift b/Sources/TestPeripheral/TestPeripheral.swift index 14a0f2c..c8b8580 100644 --- a/Sources/TestPeripheral/TestPeripheral.swift +++ b/Sources/TestPeripheral/TestPeripheral.swift @@ -275,3 +275,29 @@ final class TestPeripheral: NSObject, CBPeripheralManagerDelegate { peripheral.respond(to: first, withResult: .success) } } + + +extension CBManagerState: @retroactive CustomStringConvertible, @retroactive CustomDebugStringConvertible { + public var description: String { + switch self { + case .unknown: + "unknown" + case .resetting: + "resetting" + case .unsupported: + "unsupported" + case .unauthorized: + "unauthorized" + case .poweredOff: + "poweredOff" + case .poweredOn: + "poweredOn" + @unknown default: + "CBManagerState(rawValue: \(rawValue))" + } + } + + public var debugDescription: String { + description + } +}