IGListKit v5.0.0 Release Notes

  • ๐Ÿ’ฅ Breaking Changes

    • โœ‚ Removed unneeded diffing functions IGListDiffExperiment(...) and IGListDiffPathsExperiment(...). Maxime Ollivier (tbd)

    • โœ… ListSectionController.collectionContext and ListGenericSectionController.object are now implicitly-unwrapped optionals in Swift. Nate Stedman (tbd)

    • โšก๏ธ The argument of IGListGenericSectionController's -didUpdateToObject: is now generic, not id. Nate Stedman (tbd)

    • โšก๏ธ Updated IGListUpdatingDelegate, including a new method to safely perform [IGListAdapter setDataSource:] and changes to -performUpdateWithCollectionViewBlock that allows section-controllers to be created before the diffing (and therefore use a more accurate toObjects array) Maxime Ollivier (tbd)

    // OLD
    - (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock
                                     fromObjects:(nullable NSArray<id <IGListDiffable>> *)fromObjects
                                  toObjectsBlock:(nullable IGListToObjectBlock)toObjectsBlock
                                        animated:(BOOL)animated
                           objectTransitionBlock:(IGListObjectTransitionBlock)objectTransitionBlock
                                      completion:(nullable IGListUpdatingCompletion)completion;
    
    // NEW
    - (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock
                                        animated:(BOOL)animated
                                sectionDataBlock:(IGListTransitionDataBlock)sectionDataBlock
                           applySectionDataBlock:(IGListTransitionDataApplyBlock)applySectionDataBlock
                                      completion:(nullable IGListUpdatingCompletion)completion;
    
    // NEW
    - (void)performDataSourceChange:(IGListDataSourceChangeBlock)block;
    
    • โœ‚ Removed allowsBackgroundReloading from IGListAdapterUpdater because it's causing performance issues and other bugs. Maxime Ollivier (tbd)

    • โšก๏ธ Introducing allowsBackgroundDiffing on IGListAdapterUpdater! This property lets the updater perform the diffing on a background thread. Originally introduced by Ryan Nystrom a while back. Maxime Ollivier (tbd)

    โœจ Enhancements

    • โž• Added shouldSelectItemAtIndex: to IGListSectionController . dirtmelon

    • Introduce IGListSwiftKit, with Swift refinements for dequeueReusableCellOfClass methods. Koen Punt (#1388).

    • Added APPLICATION_EXTENSION_API_ONLY support for IGListDiffKit Peter Meyers (#1422)

    • ๐ŸŽ Improved performance by deferring requesting objects from the IGListAdapterDataSource until just before diffing is executed. If n updates are coalesced into one, this results in just a single request for objects from the data source. Shipped with experiment IGListExperimentDeferredToObjectCreation from Ryan Nystrom. Maxime Ollivier (tbd)

    • ๐Ÿ‘Œ Improved performance by using reloadData when there are too many diffing updates. Shipped with experiment IGListExperimentReloadDataFallback from Ryan Nystrom. Maxime Ollivier (tbd)

    • ๐ŸŽ Small performance improvement by replacing NSSet with NSArray during the data update to avoid unnecessary hashing, especially when dealing with lots of large objects with non trivial hashes. Maxime Ollivier (tbd)

    • Lazy initialize the -emptyViewForListAdapter: Maxime Ollivier (tbd)

    • โšก๏ธ Updated IGListAdapterUpdater to be safer, more performant, and better organized! Maxime Ollivier (tbd)

      • Safely handles [IGListAdapter setDataSource:] by also invalidating the UICollectionView data.
      • Safely handles [IGListAdapter setCollectionView:] by cancelling on-going transactions.
      • Safely handles returning nil IGListSectionController from IGListAdapterDataSource by dumping objects that don't have a controller before the diffing.
      • Checks that the UICollectionView section count matches the IGListAdapter before committing the update, otherwise fallback to a reload.
      • Schedules an update block (dispatch_async) only when needed, instead of scheduling on every single call to -performUpdateWithCollectionViewBlock.
      • Wraps each update in a transaction that can be easily cancelled.
      • Uses methods instead of blocks to make the callstack easier to read in crash reports.
      • Unblocks IGListExperimentBackgroundDiffing

    ๐Ÿ›  Fixes

    • ๐Ÿ”€ IGListCollectionViewLayout should get the section/index counts via UICollectionView to stay in sync, instead of the dataSource Maxime Ollivier (tbd)

    • โœ‚ Remove [collectionView layoutIfNeeded] before scrolling in [IGListAdapter scrollToObject...] to avoid creating off-screen cells. Maxime Ollivier (tbd)

    • โœ‚ Remove [collectionView layoutIfNeeded] before updating in [IGListAdapterUpdater performBatchUpdates...] to fix occasional glitches. Maxime Ollivier (tbd)

    • ๐Ÿ›  Fixed IGListAdapterUpdaterDelegate by 1) calling willReloadDataWithCollectionView on fallback reloads and 2) making sure willPerformBatchUpdatesWithCollectionView is only called when performing a batch update. Maxime Ollivier (tbd)

    • ๐Ÿ›  Fixed missing update when calling performUpdatesAnimated multiple times quickly and using the reloadDataFallback(). Maxime Ollivier (tbd)

    • โšก๏ธ Request the UICollectionView until just-before we update. This way if the UICollectionView is changed between update-queue and execution, we guarantee the update is performed on the correct view. Ship with experiment IGListExperimentGetCollectionViewAtUpdate from Ryan Nystrom. Maxime Ollivier (tbd)