Skip to content

Commit 383c9c8

Browse files
committed
simplify how 'supportsFeatures' is implemented
1 parent 0e2cf33 commit 383c9c8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Sources/CombineCoreBluetooth/CentralManager/Live+CentralManager.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ extension CentralManager {
1111
options: options?.centralManagerDictionary
1212
)
1313

14-
#if os(macOS) && !targetEnvironment(macCatalyst)
15-
@Sendable func supportsFeatures<A>(_ feature: Never) -> A {}
16-
#else
17-
let supportsFeatures: @Sendable (_ features: CBCentralManager.Feature) -> Bool = { CBCentralManager.supports($0) }
18-
#endif
19-
2014
return Self.init(
2115
delegate: delegate,
2216
_state: { centralManager.state },
@@ -28,7 +22,13 @@ extension CentralManager {
2822
}
2923
},
3024
_isScanning: { centralManager.isScanning },
31-
_supportsFeatures: supportsFeatures,
25+
_supportsFeatures: {
26+
#if os(macOS) && !targetEnvironment(macCatalyst)
27+
// will never be called on native macOS
28+
#else
29+
CBCentralManager.supports($0)
30+
#endif
31+
},
3232
_retrievePeripheralsWithIdentifiers: { (identifiers) -> [Peripheral] in
3333
centralManager.retrievePeripherals(withIdentifiers: identifiers).map(Peripheral.init(cbperipheral:))
3434
},

0 commit comments

Comments
 (0)