-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from teufelaudio/kvo-bypass
Implements delegate kvo bypass
- Loading branch information
Showing
2 changed files
with
14 additions
and
4 deletions.
There are no files selected for viewing
10 changes: 9 additions & 1 deletion
10
Sources/CombineBluetooth/CoreBluetooth/CBCentralManager+Combine.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import CoreBluetooth | ||
|
||
extension CBCentralManager { | ||
/// Returns an implementation of CentralManager, which observes it's CBCentralManager's delegate for changes. | ||
/// In case the delegate gets changed to something other than this CentralManager implementation it'll end | ||
/// publishers with a failure. | ||
public var combine: any CentralManager { | ||
// Disable the skip of central manager delegate observation as we know the central manager is an instance of CBCentralManager. | ||
CoreBluetoothCentralManager(centralManager: self) | ||
} | ||
|
||
/// Returns an implementation of CentralManager, which *does not* observe it's CBCentralManager's delegate for changes. | ||
/// In case of change of the delegate, publishers will not end with a failure. | ||
public var combineWithoutDelegateObservation: any CentralManager { | ||
CoreBluetoothCentralManager(centralManager: self, skipDelegateObservation: true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters