LinkedInAttic / LayoutKit

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.
http://layoutkit.org
Apache License 2.0
3.16k stars 267 forks source link

Support option for custom cell type #76

Closed RoCry closed 7 years ago

RoCry commented 7 years ago

Here is why I want this:

I need add time accessory view and using pan gesture to reveal it(imaging iMessage)

So, what I did for this: register and dequeue custom cell which have a method to receive offset, and the Revealer will handle pan gesture and send the offset to visible cells.

If you guys think this will be helpful like I do, I would like to send a PR

nicksnyder commented 7 years ago

I don't understand what you are proposing. Are you talking about UITableViewCells, UICollectionViewCells, or something else?

Please elaborate.

RoCry commented 7 years ago

@nicksnyder I meant to have easy way to use subclass of UITableViewCell.

In my example, I use RevealableTableViewCell instead of just UITableViewCell

nicksnyder commented 7 years ago

What about LayoutKit is preventing you from using a custom UITableViewCell? What would you change/add to LayoutKit?

Is there a reason why you don't create a custom UIView subclass and place it in inside of UITableViewCell's contentView?

nicksnyder commented 7 years ago

@RoCry ping, can you clarify?

RoCry commented 7 years ago

@nicksnyder Very sorry for the deeeeeeelay, busy days recently..

If need custom cell in LayoutKit, I may have only one option: Take parts advantages of ReloadableViewLayoutAdapter, implement the datasource part and dequeue cell by myself. Which make the reuse code in ReloadableViewLayoutAdapter useless. So I want to change ReloadableViewLayoutAdapter if this is the best way to implement feature like I mentioned.

But you did offered another way to do it, why not a custom view inside UITableViewCell.contentView? If LayoutKit help me to reuse the custom view, it sounds a good idea. I may try this next time.

So, I think this issue could close now.

Thank you.