LayoutKit
LayoutKit copied to clipboard
Fix a recycling bug that purges indirect subviews
Only walk first level of subviews that are created by LayoutKit. If a subview isn't created by LayoutKit, then there is no need to walk subviews of it, as they must not be created by this layout.
Oh, this looks like a good improvement, thanks!
I have a couple of points:
- This avoids traversing rootView -> nonLayoutKitView -> otherLayoutKitViews, right? What if we had rootView -> LayoutKitView -> nonLayoutKitView -> otherLayoutKitViews? Perhaps we should do this check at every level?
- Do we need to check
$0.isLayoutKitView || $0.viewReuseId != nil
or is it sufficient to just check$0.isLayoutKitView
? - I liked your comment at the start of this Pull Request here, can you please add the comment to the code as well, explaining why it’s important to have the check and what problem it avoids?
Thank you!
Hi Sergei, Thanks for your review. Your points sound good. I updated my PR to include those changes. Thanks!