Hi guys, somebody is working on an UI library? I ...
# multiplatform
d
Hi guys, somebody is working on an UI library? I cannot override UITableViewDataSource property on kotlin. What am I doing wrong? Is it supported?
m
What's the error message?
d
s
Not familar with the platform but the error suggests return type needs to be boolean and you're return UITableViewCell and NSInteger instead of a Boolean
j
declaration is fine for iOS, but I'm not sure about the syntax
1. are you sure you want a UITableView and not a UITableViewController? 2.
Copy code
class TableViewTest : UITableView() {

    override fun cellForRowAtIndexPath(indexPath: NSIndexPath): UITableViewCell? {
        return super.cellForRowAtIndexPath(indexPath)
    }
}
works fine
d
yes, it right...but I want to use the UITableViewDelegate and UITableViewDatasource here as well.
n
It doesn’t get what
UITableViewCell
is. Are your imports correct?
d
yes... import platform.UIKit.*
s
Seems the compiler is getting confused. You can add
@Suppress("RETURN_TYPE_MISMATCH_ON_OVERRIDE")
to the top of your class and it should compile. One other note, there's no technical reason you can't have a subclass of a tableview act as its own data source or delegate but it isn't a practice looked favorably upon by other iOS developers. The most common practice is to have the
UIViewController
controlling the tableview act as the data source and delegate. It's also acceptable to encapsulate that logic into separate class that conforms to one or both of those protocols.
👍 1
d
as a side note, since your InnoFormTable is a subclass of NSObject (indirectly), this class will not be accessible from Objective-C or Swift. Just a heads up in case you were planning on sharing this as a framework.
👍 1
j
To answer your first question, yes, I am currently working on https://github.com/lightningkite/koolui, but I haven't done iOS yet.
💯 1
d
Thanks guys! Yeah, I understand that Sam. I was testing out the code. My idea is to build a Tableview/Recyclerview dynamically in Kotlin for a Form Builder.