LayoutKit
LayoutKit copied to clipboard
Accessing subviews in LayoutKit-generated view
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!
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.
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.