Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
Just making things more readable.
  • Loading branch information
dinesharjani committed Dec 2, 2024
1 parent c105763 commit 2d1fa1e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Sources/iOS-BLE-Library-Mock/CentralManager/CentralManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ extension CentralManager {

return self.connectedPeripheralChannel
.filter { $0.0.identifier == peripheral.identifier }
.tryMap { p in
if let e = p.1 {
throw e
.tryMap { peripheral, error in
if let error {
throw error
}

return p.0
return peripheral
}
.prefix(untilUntilOutputOrCompletion: killSwitch)
.bluetooth {
Expand Down Expand Up @@ -201,9 +201,7 @@ extension CentralManager {
/// - Returns: A list of the peripherals that are currently connected
/// to the system and that contain any of the services
/// specified in the `serviceUUID` parameter.
public func retrieveConnectedPeripherals(withServices identifiers: [CBUUID])
-> [CBPeripheral]
{
public func retrieveConnectedPeripherals(withServices identifiers: [CBUUID]) -> [CBPeripheral] {
centralManager.retrieveConnectedPeripherals(withServices: identifiers)
}

Expand All @@ -229,11 +227,7 @@ extension CentralManager {
/// - services: The services to scan for.
/// - options: A dictionary to customize the scan, such as specifying whether duplicate results should be reported.
/// - Returns: A publisher that emits scan results or an error.
public func scanForPeripherals(
withServices services: [CBUUID]?, options: [String: Any]? = nil
)
-> AnyPublisher<ScanResult, Error>
{
public func scanForPeripherals(withServices services: [CBUUID]?, options: [String: Any]? = nil) -> AnyPublisher<ScanResult, Error> {
stopScan()
return centralManagerDelegate.stateSubject
.tryFirst { state in
Expand Down

0 comments on commit 2d1fa1e

Please sign in to comment.