I'm trying to implement a Bluetooth solution using...
# multiplatform
m
I'm trying to implement a Bluetooth solution using platform specific logic. When creating a
centralManagerDelegate = object : NSObject(), CBCentralManagerDelegateProtocol
, I'm trying to implement some of its functions. However, because they all have the same function name and only vary in the parameter types, and names, I have two functions which have exactly the same parameter types required and this creates a conflicting overload. The two conflicting functions are defined below :
override fun centralManager(central: CBCentralManager, didDisconnectPeripheral: CBPeripheral, error: NSError?) {
}
override fun centralManager(central: CBCentralManager, didFailToConnectPeripheral: CBPeripheral, error: NSError?) {
}
I have tried renaming the functions but it doesn't work with overriding, and annotations such as
@ObjCName("centralManagerDidDisconnectPeripheral:error:")
don't seem to work for overriding functions. Has anyone encountered a similar issue? I am using Kotlin Multiplatform plugin version 0.6.1 and Kotlin version 1.9.0
s
See this example: https://github.com/sellmair/pacemaker/blob/master/bluetooth-core/src/appleMain/kotlin/io/sellmair/pacemaker/ble/AppleCentralManagerDelegate.kt You are required to
@Suppress("CONFLICTING_OVERLOADS", "PARAMETER_NAME_CHANGED_ON_OVERRIDE")
cc @etolstoy