RxBluetoothKit
RxBluetoothKit copied to clipboard
iOS 15 support
There are some changes to the Core Bluetooth API.
CBService
unowned(unsafe) var peripheral: CBPeripheral { get }
CBCharacteristic
unowned(unsafe) var service: CBService { get }
CBDescriptor
unowned(unsafe) var characteristic: CBCharacteristic { get }
iOS 15.X
CBService
weak var peripheral: CBPeripheral? { get }
CBCharacteristic
weak var service: CBService? { get }
CBDescriptor
weak var characteristic: CBCharacteristic? { get }
The changes are detailed describe here in this issue
Solution:
Made below classes' convenience init(…)
methods optional convenience init?(…)
and only initialize if pass in params
required properties(service, characteristic, descriptors) are not deallocated.
RxBluetoothKit
- Characteristic.swift
- Descriptor.swift
Example
convenience init?(descriptor: CBDescriptor, peripheral: Peripheral) {
guard let _characteristic = descriptor.characteristic, let _service = _characteristic.service else {
return nil
}
let service = Service(peripheral: peripheral, service: _service)
let characteristic = Characteristic(characteristic: _characteristic, service: service)
self.init(descriptor: descriptor, characteristic: characteristic)
}
Caller sites have been always guard
strogeRefeance
therefore, added an extra guard
for those that are optionally initializable.
Test
Test cases are update and force unwrapped for those optional initializable objects.
Other improvement
Fixed deprecated method signature warnings.
Thank you very much @chamira-at for this PR. A dependency of my project depends on this to unblock me of using the latest Swift version. Looking forward for @robnadin 's review.
Likewise @CSolanaM ! Friendly nudge @robnadin ;)
Likewise @CSolanaM ! Friendly nudge @robnadin ;)
Unfortunately I don't have write access so I'm not able to perform a full review, just thought I'd add my $0.02 to the changes 🙃
@minixT friendly nudge! Is there any chance you could have a look at this PR?
can you please have a look on this PR ?
@monikamsc Can you please help us reviewing this PR?
Hi 👋🏽,
Can someone with write access
have a look at on this PR and approves it :).
It has been sometime and this PR is really critical for many projects.
Really appreciate your guys hard work and Thank you 🙏🏼
Hello, Will this be released at some point?
Is there anything I can do to help get this merged in?