I have a UITableView
. I am using a class inheriting MGSwipeTableCell for my cells and I have a header which is a UIView. I have some portion of code that are pretty similar if it's not exactly the same.
I guess there is a way to write those functions once only and eventually adapt the gap for each class but I don't really know how as the classes are not of the same type.
How could I do it properly?
答案 0 :(得分:0)
Look at protocols and class extensions. You can probably design a protocol the defines the methods you want to share, and then an extension that lets you add methods and properties to your classes.