Closed gerbiljames closed 8 years ago
It’s been a frequent interrogation on the original Objective-C project.
Having a “class” parameter isn’t a well-established UIKit pattern (you can find it in AppKit, for NSControl
and NSCell
, but that’s not a great example to follow IMO).
I’d prefer to keep the table view controller as simple as possible, while letting the door open to subclassing, if you need to customize something (the cells, the header/footer, etc). So in this case, I would override tableView(:, cellForRowAtIndexPath:)
, and re-configure the cell from the main implementation, or even initialize a different cell class.
You mentioned UIAppearance
, and it might be interesting to investigate that further. I don’t know if we can better support it for this kind of customization. That would seem like a more elegant approach, if possible.
Looked into UIAppearance
(doc), and you’re right, it’s too limited for table view cells.
You're right about subclassing being the right way to go. I implemented it in my own project and it worked fine apart from being forced to implement some constructors on my subclass which shouldnt have been necessary. This was due to the same irregularity around the init(coder:)
constructor which I found when writing the localization tests and will be fixed in 0.3.
Speaking of which, time to release 0.3. It should be available now.
I've had a think about this one and I'm just not sure about how to do it. I tried subclassing
UITableViewCell
and usingUIAppearance
but for some reasonUITableViewCell
s dont support it for most of their properties.One way of offering this would be to provide a
UITableViewCell
subclass (AcknowCell
) which has a customisation function which can be overridden. My issue with this is how shouldAcknowListViewController
be told to use a custom cell implementation. I don't think we should add any new parameters to the constructors but it would be possible to add a property toAcknowListViewController
which specifies which cell class it should use.What do you think?