Skip to content

Commit 4fe0939

Browse files
committed
underscore Internal type to not expose it to autocomplete
1 parent c1338a2 commit 4fe0939

6 files changed

Lines changed: 76 additions & 76 deletions

File tree

Sources/CombineCoreBluetooth/Central/Mock+Central.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33
extension Central {
44
public static func unimplemented(
55
identifier: UUID,
6-
maximumUpdateValueLength: @escaping () -> Int = Internal._unimplemented("maximumUpdateValueLength")
6+
maximumUpdateValueLength: @escaping () -> Int = _Internal._unimplemented("maximumUpdateValueLength")
77
) -> Self {
88
return .init(
99
rawValue: nil,

Sources/CombineCoreBluetooth/CentralManager/Mock+CentralManager.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ import CoreBluetooth
44

55
extension CentralManager {
66
public static func unimplemented(
7-
state: @escaping () -> CBManagerState = Internal._unimplemented("state"),
8-
authorization: @escaping () -> CBManagerAuthorization = Internal._unimplemented("authorization"),
9-
isScanning: @escaping () -> Bool = Internal._unimplemented("isScanning"),
10-
supportsFeatures: @escaping (Feature) -> Bool = Internal._unimplemented("supportsFeatures"),
11-
retrievePeripheralsWithIdentifiers: @escaping ([UUID]) -> [Peripheral] = Internal._unimplemented("retrievePeripheralsWithIdentifiers"),
12-
retrieveConnectedPeripheralsWithServices: @escaping ([CBUUID]) -> [Peripheral] = Internal._unimplemented("retrieveConnectedPeripheralsWithServices"),
13-
scanForPeripheralsWithServices: @escaping ([CBUUID]?, ScanOptions?) -> Void = Internal._unimplemented("scanForPeripheralsWithServices"),
14-
stopScanForPeripherals: @escaping () -> Void = Internal._unimplemented("stopScanForPeripherals"),
15-
connectToPeripheral: @escaping (Peripheral, PeripheralConnectionOptions?) -> Void = Internal._unimplemented("connectToPeripheral"),
16-
cancelPeripheralConnection: @escaping (Peripheral) -> Void = Internal._unimplemented("cancelPeripheralConnection"),
17-
registerForConnectionEvents: @escaping ([CBConnectionEventMatchingOption : Any]?) -> Void = Internal._unimplemented("registerForConnectionEvents"),
7+
state: @escaping () -> CBManagerState = _Internal._unimplemented("state"),
8+
authorization: @escaping () -> CBManagerAuthorization = _Internal._unimplemented("authorization"),
9+
isScanning: @escaping () -> Bool = _Internal._unimplemented("isScanning"),
10+
supportsFeatures: @escaping (Feature) -> Bool = _Internal._unimplemented("supportsFeatures"),
11+
retrievePeripheralsWithIdentifiers: @escaping ([UUID]) -> [Peripheral] = _Internal._unimplemented("retrievePeripheralsWithIdentifiers"),
12+
retrieveConnectedPeripheralsWithServices: @escaping ([CBUUID]) -> [Peripheral] = _Internal._unimplemented("retrieveConnectedPeripheralsWithServices"),
13+
scanForPeripheralsWithServices: @escaping ([CBUUID]?, ScanOptions?) -> Void = _Internal._unimplemented("scanForPeripheralsWithServices"),
14+
stopScanForPeripherals: @escaping () -> Void = _Internal._unimplemented("stopScanForPeripherals"),
15+
connectToPeripheral: @escaping (Peripheral, PeripheralConnectionOptions?) -> Void = _Internal._unimplemented("connectToPeripheral"),
16+
cancelPeripheralConnection: @escaping (Peripheral) -> Void = _Internal._unimplemented("cancelPeripheralConnection"),
17+
registerForConnectionEvents: @escaping ([CBConnectionEventMatchingOption : Any]?) -> Void = _Internal._unimplemented("registerForConnectionEvents"),
1818

19-
didUpdateState: AnyPublisher<CBManagerState, Never> = Internal._unimplemented("didUpdateState"),
20-
willRestoreState: AnyPublisher<[String: Any], Never> = Internal._unimplemented("willRestoreState"),
21-
didConnectPeripheral: AnyPublisher<Peripheral, Never> = Internal._unimplemented("didConnectPeripheral"),
22-
didFailToConnectPeripheral: AnyPublisher<(Peripheral, Error?), Never> = Internal._unimplemented("didFailToConnectToPeripheral"),
23-
didDisconnectPeripheral: AnyPublisher<(Peripheral, Error?), Never> = Internal._unimplemented("didDisconnectPeripheral"),
19+
didUpdateState: AnyPublisher<CBManagerState, Never> = _Internal._unimplemented("didUpdateState"),
20+
willRestoreState: AnyPublisher<[String: Any], Never> = _Internal._unimplemented("willRestoreState"),
21+
didConnectPeripheral: AnyPublisher<Peripheral, Never> = _Internal._unimplemented("didConnectPeripheral"),
22+
didFailToConnectPeripheral: AnyPublisher<(Peripheral, Error?), Never> = _Internal._unimplemented("didFailToConnectToPeripheral"),
23+
didDisconnectPeripheral: AnyPublisher<(Peripheral, Error?), Never> = _Internal._unimplemented("didDisconnectPeripheral"),
2424

25-
connectionEventDidOccur: AnyPublisher<(CBConnectionEvent, Peripheral), Never> = Internal._unimplemented("connectionEventDidOccur"),
26-
didDiscoverPeripheral: AnyPublisher<PeripheralDiscovery, Never> = Internal._unimplemented("didDiscoverPeripheral"),
25+
connectionEventDidOccur: AnyPublisher<(CBConnectionEvent, Peripheral), Never> = _Internal._unimplemented("connectionEventDidOccur"),
26+
didDiscoverPeripheral: AnyPublisher<PeripheralDiscovery, Never> = _Internal._unimplemented("didDiscoverPeripheral"),
2727

28-
didUpdateACNSAuthorizationForPeripheral: AnyPublisher<Peripheral, Never> = Internal._unimplemented("didUpdateACNSAuthorizationForPeripheral")
28+
didUpdateACNSAuthorizationForPeripheral: AnyPublisher<Peripheral, Never> = _Internal._unimplemented("didUpdateACNSAuthorizationForPeripheral")
2929
) -> Self {
3030
return Self(
3131
delegate: nil,

Sources/CombineCoreBluetooth/Internal/Unimplemented.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public enum Internal {
3+
public enum _Internal {
44
public static func _unimplemented<Output>(
55
_ function: StaticString, file: StaticString = #file, line: UInt = #line
66
) -> () -> Output {

Sources/CombineCoreBluetooth/Peripheral/Interface+Peripheral.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public struct Peripheral {
259259
})
260260
.shareCurrentValue()
261261
}
262-
262+
263263
// MARK: - Convenience methods
264264

265265
/// Discovers the service with the given service UUID, then discovers characteristics with the given UUIDs and returns those.

Sources/CombineCoreBluetooth/Peripheral/Mock+Peripheral.swift

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@ extension Peripheral {
44
public static func unimplemented(
55
name: String? = nil,
66
identifier: UUID = .init(),
7-
state: @escaping () -> CBPeripheralState = Internal._unimplemented("state"),
8-
services: @escaping () -> [CBService]? = Internal._unimplemented("services"),
9-
canSendWriteWithoutResponse: @escaping () -> Bool = Internal._unimplemented("canSendWriteWithoutResponse"),
10-
ancsAuthorized: @escaping () -> Bool = Internal._unimplemented("ancsAuthorized"),
11-
readRSSI: @escaping () -> Void = Internal._unimplemented("readRSSI"),
12-
discoverServices: @escaping ([CBUUID]?) -> Void = Internal._unimplemented("discoverServices") ,
13-
discoverIncludedServices: @escaping ([CBUUID]?, CBService) -> Void = Internal._unimplemented("discoverIncludedServices"),
14-
discoverCharacteristics: @escaping ([CBUUID]?, CBService) -> Void = Internal._unimplemented("discoverCharacteristics"),
15-
readValueForCharacteristic: @escaping (CBCharacteristic) -> Void = Internal._unimplemented("readValueForCharacteristic"),
16-
maximumWriteValueLength: @escaping (CBCharacteristicWriteType) -> Int = Internal._unimplemented("maximumWriteValueLength"),
17-
writeValueForCharacteristic: @escaping (Data, CBCharacteristic, CBCharacteristicWriteType) -> Void = Internal._unimplemented("writeValueForCharacteristic"),
18-
setNotifyValue: @escaping (Bool, CBCharacteristic) -> Void = Internal._unimplemented("setNotifyValue"),
19-
discoverDescriptors: @escaping (CBCharacteristic) -> Void = Internal._unimplemented("discoverDescriptors"),
20-
readValueForDescriptor: @escaping (CBDescriptor) -> Void = Internal._unimplemented("readValueForDescriptor"),
21-
writeValueForDescriptor: @escaping (Data, CBDescriptor) -> Void = Internal._unimplemented("writeValueForDescriptor"),
22-
openL2CAPChannel: @escaping (CBL2CAPPSM) -> Void = Internal._unimplemented("openL2CAPChannel"),
23-
didReadRSSI: AnyPublisher<Result<Double, Error>, Never> = Internal._unimplemented("didReadRSSI"),
24-
didDiscoverServices: AnyPublisher<([CBService], Error?), Never> = Internal._unimplemented("didDiscoverServices"),
25-
didDiscoverIncludedServices: AnyPublisher<(CBService, Error?), Never> = Internal._unimplemented("didDiscoverIncludedServices"),
26-
didDiscoverCharacteristics: AnyPublisher<(CBService, Error?), Never> = Internal._unimplemented("didDiscoverCharacteristics"),
27-
didUpdateValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never> = Internal._unimplemented("didUpdateValueForCharacteristic"),
28-
didWriteValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never> = Internal._unimplemented("didWriteValueForCharacteristic"),
29-
didUpdateNotificationState: AnyPublisher<(CBCharacteristic, Error?), Never> = Internal._unimplemented("didUpdateNotificationState"),
30-
didDiscoverDescriptorsForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never> = Internal._unimplemented("didDiscoverDescriptorsForCharacteristic"),
31-
didUpdateValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never> = Internal._unimplemented("didUpdateValueForDescriptor"),
32-
didWriteValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never> = Internal._unimplemented("didWriteValueForDescriptor"),
33-
didOpenChannel: AnyPublisher<(L2CAPChannel?, Error?), Never> = Internal._unimplemented("didOpenChannel"),
34-
isReadyToSendWriteWithoutResponse: AnyPublisher<Void, Never> = Internal._unimplemented("isReadyToSendWriteWithoutResponse"),
35-
nameUpdates: AnyPublisher<String?, Never> = Internal._unimplemented("nameUpdates"),
36-
invalidatedServiceUpdates: AnyPublisher<[CBService], Never> = Internal._unimplemented("invalidatedServiceUpdates")
7+
state: @escaping () -> CBPeripheralState = _Internal._unimplemented("state"),
8+
services: @escaping () -> [CBService]? = _Internal._unimplemented("services"),
9+
canSendWriteWithoutResponse: @escaping () -> Bool = _Internal._unimplemented("canSendWriteWithoutResponse"),
10+
ancsAuthorized: @escaping () -> Bool = _Internal._unimplemented("ancsAuthorized"),
11+
readRSSI: @escaping () -> Void = _Internal._unimplemented("readRSSI"),
12+
discoverServices: @escaping ([CBUUID]?) -> Void = _Internal._unimplemented("discoverServices") ,
13+
discoverIncludedServices: @escaping ([CBUUID]?, CBService) -> Void = _Internal._unimplemented("discoverIncludedServices"),
14+
discoverCharacteristics: @escaping ([CBUUID]?, CBService) -> Void = _Internal._unimplemented("discoverCharacteristics"),
15+
readValueForCharacteristic: @escaping (CBCharacteristic) -> Void = _Internal._unimplemented("readValueForCharacteristic"),
16+
maximumWriteValueLength: @escaping (CBCharacteristicWriteType) -> Int = _Internal._unimplemented("maximumWriteValueLength"),
17+
writeValueForCharacteristic: @escaping (Data, CBCharacteristic, CBCharacteristicWriteType) -> Void = _Internal._unimplemented("writeValueForCharacteristic"),
18+
setNotifyValue: @escaping (Bool, CBCharacteristic) -> Void = _Internal._unimplemented("setNotifyValue"),
19+
discoverDescriptors: @escaping (CBCharacteristic) -> Void = _Internal._unimplemented("discoverDescriptors"),
20+
readValueForDescriptor: @escaping (CBDescriptor) -> Void = _Internal._unimplemented("readValueForDescriptor"),
21+
writeValueForDescriptor: @escaping (Data, CBDescriptor) -> Void = _Internal._unimplemented("writeValueForDescriptor"),
22+
openL2CAPChannel: @escaping (CBL2CAPPSM) -> Void = _Internal._unimplemented("openL2CAPChannel"),
23+
didReadRSSI: AnyPublisher<Result<Double, Error>, Never> = _Internal._unimplemented("didReadRSSI"),
24+
didDiscoverServices: AnyPublisher<([CBService], Error?), Never> = _Internal._unimplemented("didDiscoverServices"),
25+
didDiscoverIncludedServices: AnyPublisher<(CBService, Error?), Never> = _Internal._unimplemented("didDiscoverIncludedServices"),
26+
didDiscoverCharacteristics: AnyPublisher<(CBService, Error?), Never> = _Internal._unimplemented("didDiscoverCharacteristics"),
27+
didUpdateValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never> = _Internal._unimplemented("didUpdateValueForCharacteristic"),
28+
didWriteValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never> = _Internal._unimplemented("didWriteValueForCharacteristic"),
29+
didUpdateNotificationState: AnyPublisher<(CBCharacteristic, Error?), Never> = _Internal._unimplemented("didUpdateNotificationState"),
30+
didDiscoverDescriptorsForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never> = _Internal._unimplemented("didDiscoverDescriptorsForCharacteristic"),
31+
didUpdateValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never> = _Internal._unimplemented("didUpdateValueForDescriptor"),
32+
didWriteValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never> = _Internal._unimplemented("didWriteValueForDescriptor"),
33+
didOpenChannel: AnyPublisher<(L2CAPChannel?, Error?), Never> = _Internal._unimplemented("didOpenChannel"),
34+
isReadyToSendWriteWithoutResponse: AnyPublisher<Void, Never> = _Internal._unimplemented("isReadyToSendWriteWithoutResponse"),
35+
nameUpdates: AnyPublisher<String?, Never> = _Internal._unimplemented("nameUpdates"),
36+
invalidatedServiceUpdates: AnyPublisher<[CBService], Never> = _Internal._unimplemented("invalidatedServiceUpdates")
3737
) -> Peripheral {
3838
Peripheral(
3939
rawValue: nil,

Sources/CombineCoreBluetooth/PeripheralManager/Mock+PeripheralManager.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ import Foundation
22

33
extension PeripheralManager {
44
public static func unimplemented(
5-
state: @escaping () -> CBManagerState = Internal._unimplemented("state"),
6-
authorization: @escaping () -> CBManagerAuthorization = Internal._unimplemented("authorization"),
7-
isAdvertising: @escaping () -> Bool = Internal._unimplemented("isAdvertising"),
8-
startAdvertising: @escaping (AdvertisementData?) -> Void = Internal._unimplemented("startAdvertising"),
9-
stopAdvertising: @escaping () -> Void = Internal._unimplemented("stopAdvertising"),
10-
setDesiredConnectionLatency: @escaping (CBPeripheralManagerConnectionLatency, Central) -> Void = Internal._unimplemented("setDesiredConnectionLatency"),
11-
add: @escaping (CBMutableService) -> Void = Internal._unimplemented("add"),
12-
remove: @escaping (CBMutableService) -> Void = Internal._unimplemented("remove"),
13-
removeAllServices: @escaping () -> Void = Internal._unimplemented("removeAllServices"),
14-
respondToRequest: @escaping (ATTRequest, CBATTError.Code) -> Void = Internal._unimplemented("respondToRequest"),
15-
updateValueForCharacteristic: @escaping (Data, CBMutableCharacteristic, [Central]?) -> Bool = Internal._unimplemented("updateValueForCharacteristic"),
16-
publishL2CAPChannel: @escaping (Bool) -> Void = Internal._unimplemented("publishL2CAPChannel"),
17-
unpublishL2CAPChannel: @escaping (CBL2CAPPSM) -> Void = Internal._unimplemented("unpublishL2CAPChannel"),
5+
state: @escaping () -> CBManagerState = _Internal._unimplemented("state"),
6+
authorization: @escaping () -> CBManagerAuthorization = _Internal._unimplemented("authorization"),
7+
isAdvertising: @escaping () -> Bool = _Internal._unimplemented("isAdvertising"),
8+
startAdvertising: @escaping (AdvertisementData?) -> Void = _Internal._unimplemented("startAdvertising"),
9+
stopAdvertising: @escaping () -> Void = _Internal._unimplemented("stopAdvertising"),
10+
setDesiredConnectionLatency: @escaping (CBPeripheralManagerConnectionLatency, Central) -> Void = _Internal._unimplemented("setDesiredConnectionLatency"),
11+
add: @escaping (CBMutableService) -> Void = _Internal._unimplemented("add"),
12+
remove: @escaping (CBMutableService) -> Void = _Internal._unimplemented("remove"),
13+
removeAllServices: @escaping () -> Void = _Internal._unimplemented("removeAllServices"),
14+
respondToRequest: @escaping (ATTRequest, CBATTError.Code) -> Void = _Internal._unimplemented("respondToRequest"),
15+
updateValueForCharacteristic: @escaping (Data, CBMutableCharacteristic, [Central]?) -> Bool = _Internal._unimplemented("updateValueForCharacteristic"),
16+
publishL2CAPChannel: @escaping (Bool) -> Void = _Internal._unimplemented("publishL2CAPChannel"),
17+
unpublishL2CAPChannel: @escaping (CBL2CAPPSM) -> Void = _Internal._unimplemented("unpublishL2CAPChannel"),
1818

19-
didUpdateState: AnyPublisher<CBManagerState, Never> = Internal._unimplemented("didUpdateState"),
20-
didStartAdvertising: AnyPublisher<Error?, Never> = Internal._unimplemented("didStartAdvertising"),
21-
didAddService: AnyPublisher<(CBService, Error?), Never> = Internal._unimplemented("didAddService"),
22-
centralDidSubscribeToCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never> = Internal._unimplemented("centralDidSubscribeToCharacteristic"),
23-
centralDidUnsubscribeToCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never> = Internal._unimplemented("centralDidUnsubscribeToCharacteristic"),
24-
didReceiveReadRequest: AnyPublisher<ATTRequest, Never> = Internal._unimplemented("didReceiveReadRequest"),
25-
didReceiveWriteRequests: AnyPublisher<[ATTRequest], Never> = Internal._unimplemented("didReceiveWriteRequests"),
26-
readyToUpdateSubscribers: AnyPublisher<Void, Never> = Internal._unimplemented("readyToUpdateSubscribers"),
27-
didPublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never> = Internal._unimplemented("didPublishL2CAPChannel"),
28-
didUnpublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never> = Internal._unimplemented("didUnpublishL2CAPChannel"),
29-
didOpenL2CAPChannel: AnyPublisher<(L2CAPChannel?, Error?), Never> = Internal._unimplemented("didOpenL2CAPChannel")
19+
didUpdateState: AnyPublisher<CBManagerState, Never> = _Internal._unimplemented("didUpdateState"),
20+
didStartAdvertising: AnyPublisher<Error?, Never> = _Internal._unimplemented("didStartAdvertising"),
21+
didAddService: AnyPublisher<(CBService, Error?), Never> = _Internal._unimplemented("didAddService"),
22+
centralDidSubscribeToCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never> = _Internal._unimplemented("centralDidSubscribeToCharacteristic"),
23+
centralDidUnsubscribeToCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never> = _Internal._unimplemented("centralDidUnsubscribeToCharacteristic"),
24+
didReceiveReadRequest: AnyPublisher<ATTRequest, Never> = _Internal._unimplemented("didReceiveReadRequest"),
25+
didReceiveWriteRequests: AnyPublisher<[ATTRequest], Never> = _Internal._unimplemented("didReceiveWriteRequests"),
26+
readyToUpdateSubscribers: AnyPublisher<Void, Never> = _Internal._unimplemented("readyToUpdateSubscribers"),
27+
didPublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never> = _Internal._unimplemented("didPublishL2CAPChannel"),
28+
didUnpublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never> = _Internal._unimplemented("didUnpublishL2CAPChannel"),
29+
didOpenL2CAPChannel: AnyPublisher<(L2CAPChannel?, Error?), Never> = _Internal._unimplemented("didOpenL2CAPChannel")
3030
) -> Self {
3131
self.init(
3232
delegate: nil,

0 commit comments

Comments
 (0)