There’s no way I can do that, right? It says there...
# kotlin-native
r
There’s no way I can do that, right? It says there’s a conflicting overload, which I understand, but…
Copy code
class MyUITableViewDelegate : NSObject(), UITableViewDelegateProtocol {

    companion object : NSObjectMeta(), UITableViewDelegateProtocolMeta

    override fun tableView(tableView: UITableView, didSelectRowAtIndexPath: NSIndexPath) {
        // Things
    }

    override fun tableView(tableView: UITableView, heightForRowAtNSIndexPath: NSIndexPath): CGFloat =
        UITableViewAutomaticDimension

}
r
I think you can handle this with
@Suppress("CONFLICTING_OVERLOADS")
. I haven't tried it in a while but it's recommended in https://kotlinlang.org/docs/reference/native/objc_interop.html#subclassing-swiftobjective-c-classes-and-protocols-from-kotlin
k
it compiles but the IDE complains about it
at least, that's been my experience
r
Can probably suppress the IDE warning too
k
i haven't found anything that works
r
Hmm that didn’t seem to work last time I tried that
Let’s see
Well that just works
I added the suppress to the other ones you’re forced to have when implementing delegates, it immediately removed the IDE errors and it compiles and runs. I now have this at the top of this file:
Copy code
@file:Suppress(
    "CONFLICTING_OVERLOADS",
    "PARAMETER_NAME_CHANGED_ON_OVERRIDE",
    "RETURN_TYPE_MISMATCH_ON_OVERRIDE"
)
Maybe it has been fixed in Kotlin 1.4, who knows. It’s nice anyway
k
will have to give that a go