Trying to implement a `UITableViewDataSource` Prot...
# ios
d
Trying to implement a
UITableViewDataSource
Protocol in pure Kotlin... The bridging seems to think I'm overriding a totally different method signature in the protocol, and so is throwing a compile error (on the return type). Is this expected? A bug? Workarounds exist with annotations?
s
The bridging seems to think I’m overriding a totally different method signature in the protocol, and so is throwing a compile error (on the return type)
Could you clarify? Btw, to override Objective-C method, you have to use the same parameter names.
d
I used IntelliJ's own code generation to override. I'll provide exact failing code:
Copy code
class Source : NSObject(), UITableViewDataSourceProtocol {

    override fun tableView(tableView: UITableView, cellForRowAtIndexPath: NSIndexPath): UITableViewCell {...}

    override fun tableView(tableView: UITableView, numberOfRowsInSection: NSInteger): NSInteger {...}
}
message has been deleted
I tried applying explicit
@ObjCMethod
to reaffirm ObjC signature, but no change.
s
This issue is likely to be related to Kotlin/Native support in IntelliJ IDEA. The compiler should handle this code properly. Could you check this?
d
Yes, it does compile correctly despite the IDE errors - apologies for not checking that earlier.
s
It’s ok 🙂 Could you please report the IDE issue to https://github.com/JetBrains/kotlin-native/issues ?
d