I want to implement the approach used by UITableView
.
I have subclass UITableView
with my own class FloatingTableView
I want to override the delegate
of UITableView
which is UITableViewDelegate
with my delegate
of type FloatingTableViewDelegate
just the way UITableView
inherit from UIScrollView
and override the UIScrollViewDelegate
with UITableViewDelegate
both class have same property with name delegate
but have different types.
I have also tried to inherit my protocol with UITableViewDelegate
But when i try to create property with name delegate
of type FloatingTableViewDelegate
I get this error..
Property 'delegate' with type 'MyTableViewDelegate?' cannot override a property with type 'UITableViewDelegate?'
Here is my sample code.
protocol MyTableViewDelegate: UITableViewDelegate {
func isDemoDelegateMethod()
}
class MyTableView: UITableView {
weak var delegate: MyTableViewDelegate?
}