I am getting a 'Type of expression is ambiguous without more context ' on this part of code from a project. I tried different things but can't get it to work.
The problem is on the syntax of this line:
.map { args -> (CBCharacteristic, Error?) in
let characteristic = args[1] as! CBCharacteristic
let error = args[2] as? Error
return (characteristic, error)
}
Full code:
var didUpdateValue: ControlEvent<(CBCharacteristic, Error?)> {
let events = delegate
.methodInvoked(#selector(CBPeripheralDelegate.peripheral(_:didUpdateValueFor:error:) as ((CBPeripheralDelegate) -> (CBPeripheral, CBCharacteristic, Error?) -> Void)?))
.map { args -> (CBCharacteristic, Error?) in
let characteristic = args[1] as! CBCharacteristic
let error = args[2] as? Error
return (characteristic, error)
}
return ControlEvent(events: events)
}
I tried different aproximations but no combination of parameters works for me. My project wont compile without it.