LayoutKit icon indicating copy to clipboard operation
LayoutKit copied to clipboard

Accessing subviews in LayoutKit-generated view

Open dkindler opened this issue 8 years ago • 2 comments

Hello,

Is there a recommended way to get at subviews of a LayoutKit-generated view?

I'm currently iterating through the subviews of a view using viewReuseId, but I've also considered capturing a reference to the view in the configure block of the Layout. Both of these are clunky and I'd like to consider other options.

For context, I'm trying to perform a custom UIViewController transition from a UICollectionViewCell created by LayoutKit. My animation requires me to move (or duplicate and move) specific subviews in my cell, and I'd really like to use LayoutKit for my cells.

Thank you for any help in advance!

dkindler avatar Feb 21 '17 20:02 dkindler

We tend to capture the reference in the configure block, but that code predates viewReuseId. Let us know which pattern ends up working better for you or if we can add something to LayoutKit to make this better.

staguer avatar Feb 23 '17 19:02 staguer

We're considering adding a return value to the makeViews method. It would return a dictionary of layouts to the corresponding views after the view creation finishes.

The collection / table view adapter would add a delegate to notify its owner when a cell has been created and that dictionary would be passed to that.

staguer avatar Apr 06 '17 01:04 staguer