Instagram / Instagram/IGListKit

[RFC] Provide UIKit bindings for diffs *outside* of the SectionController + ListAdapter flow

Open
#870 3 comments 4 reactions 1 assignee Claimed by @jessesquires View on GitHub
enhancement proposal
Dominant language
Objective-C
Stars
13.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

## Provide UIKit bindings for diffs *outside* of the SectionController + ListAdapter flow

One barrier to using IGLK is adopting the `SectionController` + `ListAdapter` architecture, which is difficult for legacy projects, or projects that have adopted other "list" abstractions but now want to implement diffing for those lists.

Currently, we provide a `Diffing` subspec, but this requires clients to write bindings to `UICollectionView` and `UITableView` themselves. IGLK should provide this instead.

### Proposal

Provide extension methods on `UITableView` and `UICollectionView` that will perform updates on the view given the results from the [IGListDiff](https://github.com/Instagram/IGListKit/blob/master/Source/Common/IGListDiff.h) C functions. Essentially, we want to expose the functionality of [IGListAdapterUpdater](https://github.com/Instagram/IGListKit/blob/master/Source/IGListAdapterUpdater.m) in way that allows clients to perform updates *without* using `SectionController`s and `ListAdapter`s.

### Pseudo example

```swift
let old = //...

let new = //....

let diffResults = ListDiff(oldArray:old newArray:new option:IGListDiffEquality)

collectionView.performBatchUpdates(diffResults: diffResults, completion: {
// completion block
})

// table view follows similarly
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.