LayoutKit icon indicating copy to clipboard operation
LayoutKit copied to clipboard

Does arrangement in ReloadableViewLayoutAdapter need replace every time?

Open RoCry opened this issue 7 years ago • 3 comments

https://github.com/linkedin/LayoutKit/blob/master/LayoutKit/Views/ReloadableViewLayoutAdapter.swift#L91-L93

Say I have a table view with 1000 items, then I insert 1 item in it, it will regenerate the whole arrangement...

Could we just replace the updated items?

RoCry avatar Apr 13 '17 10:04 RoCry

It does regenerate all arrangements. Now that BatchUpdates is a parameter (it wasn't initially), it would be possible to do the optimization you suggest. This optimization can only be done though when BatchUpdates is non-nil (otherwise we don't know what has changed).

nicksnyder avatar Apr 17 '17 15:04 nicksnyder

@nicksnyder Sure, what I want to do is avoid regenerate all arrangements when possible.

I would like to send a PR about this if you agree. Thanks.

RoCry avatar Apr 18 '17 01:04 RoCry

Yeah, a PR would be welcome, thanks!

nicksnyder avatar Apr 18 '17 04:04 nicksnyder