Skip to content

0.5.8 - Fewer iOS row rebinds

Latest

Choose a tag to compare

@Redth Redth released this 19 Nov 18:28
f7cd807

Improvements

  • iOS / Mac Catalyst rebinds rows far less often. Rows that rebuild content on BindingContextChanged, or that have expensive bindings, do much less work during reloads, size changes (rotation, fold/unfold, window resizes), and when the list first connects. (#82, #83)

    • Cell reuse keeps the previous BindingContext until the next item is bound, the same as Android. BindingContext used to be cleared on reuse, which pushed default values through every binding.
    • When UIKit asks again for a row it already showed, the item isn't reset unless the data changed in the meantime. Data invalidations, item refreshes, and keyed updates still re-apply bindings.
    • One native reload when the list connects. Connecting used to call ReloadData() once per mapped property, 11 times in total.
    • Rows keep their content when UIKit shuffles cells. After a reload or a size change, UIKit returns the visible cells in arbitrary order. Each row used to be rebuilt for an item that a different cell had just shown. Now, when a cell is asked for an item that a pooled cell still holds, the two cells swap content, so nothing is rebuilt.

    In a fold/unfold test with about 8 visible rows over 3 cycles, BindingContextChanged events dropped from 48 to 0, and connect-time reloads dropped from 11 to 1.

Notes

  • To turn off the content swapping between cells, call AppContext.SetSwitch("Microsoft.Maui.VirtualListView.DisableContentAffinity", true) at startup.
  • Pooled iOS cells now hold a reference to their last item until they are reused or released, as on Android.

No public API changes. Upgrading from 0.5.7 needs no code changes.