LayoutKit icon indicating copy to clipboard operation
LayoutKit copied to clipboard

Fix a recycling bug that purges indirect subviews

Open Biinngg opened this issue 6 years ago • 2 comments

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.

Biinngg avatar Nov 01 '18 04:11 Biinngg

Oh, this looks like a good improvement, thanks!

I have a couple of points:

  1. This avoids traversing rootView -> nonLayoutKitView -> otherLayoutKitViews, right? What if we had rootView -> LayoutKitView -> nonLayoutKitView -> otherLayoutKitViews? Perhaps we should do this check at every level?
  2. Do we need to check $0.isLayoutKitView || $0.viewReuseId != nil or is it sufficient to just check $0.isLayoutKitView?
  3. 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!

staguer avatar Nov 01 '18 15:11 staguer

Hi Sergei, Thanks for your review. Your points sound good. I updated my PR to include those changes. Thanks!

Biinngg avatar Nov 02 '18 03:11 Biinngg