nicklockwood / layout

A declarative UI framework for iOS
MIT License
2.23k stars 97 forks source link

UITableViewCell subclass using an xml layout #179

Open algrid opened 5 years ago

algrid commented 5 years ago

Is there a way to achieve that?

When I'm trying something like this:

class MyTableViewCell: UITableViewCell, LayoutLoading {

I'm getting the following error: Type 'MyTableViewCell' does not conform to protocol 'LayoutLoading'.

My original problem is that I want to use a library like Kingfisher or SDWebImage to load an image inside my cell. layoutNode.setState doesn't allow that, so it looks like I need an outlet, but I don't know how to create an outlet for a view in a Layout-based UITableViewCell.

I can create a custom view for my cell contents and then manually put it into a UITableViewCell subclass, but is there a better way to do it?