For example there is a method func centralManager(_ cbCentralManager: CBCentralManager, didDiscover cbPeripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) from CBCentralManagerDelegate
In our project we send advertisement data forward as we need it in the app to check if device is correct and to verify ids so that we will connect to right device.
I made a Sendable structure for storing scan data:
public let peripheral: Peripheral
/// A dictionary containing any advertisement and scan response data.
public let advertisementData: [String : Any]
/// The current RSSI of the peripheral, in dBm. A value of 127 is reserved and indicates the RSSI
/// was not available.
public let rssi: NSNumber
}
and I get warning: Stored property 'advertisementData' of 'Sendable'-conforming struct 'ScanData' has non-sendable type '[String : Any]'; this is an error in the Swift 6 language mode
So what to do here?
We want to make our projects Swift6 ready and also have strict concurrency, but default API we have are making this impossible on some parts.
Second example is usage of NSPRedicate in HKAnchoredObjectQuery initializer. It is not sendable, which also throws warning for Swift6.