Classes
The following classes are available globally.
-
An instance of
See moreIGListBatchUpdateDatatakes section indexes and item index paths and performs cleanup on init in order to perform a crash-free update via-[UICollectionView performBatchUpdates:completion:].Declaration
Objective-C
@interface IGListBatchUpdateData : NSObjectSwift
class ListBatchUpdateData : NSObject -
A result object returned when diffing with sections.
See moreDeclaration
Objective-C
@interface IGListIndexPathResult : NSObjectSwift
class ListIndexPathResult : NSObject -
A result object returned when diffing with indexes.
See moreDeclaration
Objective-C
@interface IGListIndexSetResult : NSObjectSwift
class ListIndexSetResult : NSObject -
An object representing a move between indexes.
See moreDeclaration
Objective-C
@interface IGListMoveIndex : NSObjectSwift
class ListMoveIndex : NSObject -
An object representing a move between indexes.
See moreDeclaration
Objective-C
@interface IGListMoveIndexPath : NSObjectSwift
class ListMoveIndexPath : NSObject -
IGListAdapterobjects provide an abstraction for feeds of objects in aUICollectionViewby breaking each object into individual sections, called “section controllers”. These controllers (objects subclassing toIGListSectionController) act as a data source and delegate for each section.Feed implementations must act as the data source for an
See moreIGListAdapterin order to drive the objects and section controllers in a collection view.Declaration
Objective-C
@interface IGListAdapter : NSObjectSwift
class ListAdapter : NSObject -
An
IGListAdapterUpdateris a concrete type that conforms toIGListUpdatingDelegate. It is an out-of-box updater forIGListAdapterobjects to use.See moreNote
This updater performs re-entrant, coalesced updating for a list. It also uses a least-minimal diff for calculating UI updates whenIGListAdaptercalls-performUpdateWithCollectionView:fromObjects:toObjects:completion:.Declaration
Objective-C
@interface IGListAdapterUpdater : NSObject <IGListUpdatingDelegate>Swift
class ListAdapterUpdater : NSObject, ListUpdatingDelegate -
This section controller uses a data source to transform its “top level” object into an array of diffable view models. It then automatically binds each view model to cells via the
IGListBindableprotocol.Models used with
IGListBindingSectionControllershould take special care to always returnYESfor identical objects. That is, any objects with matching-diffIdentifiers should always be equal, that way the section controller can create new view models via the data source, create a diff, and update the specific cells that have changed.In Objective-C, your
-isEqualToDiffableObject:can simply be:- (BOOL)isEqualToDiffableObject:(id)object { return YES; }In Swift:
func isEqual(toDiffableObject object: IGListDiffable?) -> Bool { return true }Only when
See more-diffIdentifiers match is object equality compared, so you can assume the class is the same, and the instance has already been checked.Declaration
Objective-C
@interface IGListBindingSectionController< __covariant ObjectType : id <IGListDiffable>> : IGListSectionControllerSwift
class ListBindingSectionController<ObjectType> : ListSectionController where ObjectType : ListDiffable -
Special section controller that only contains a single item, and it will apply the view model update during -didUpdateObject: call, usually happened inside -[UICollectionView performBatchUpdates:completion:].
This class is intended to be subclassed.
See moreDeclaration
Objective-C
@interface IGListBindingSingleSectionController< __covariant ViewModel : id <IGListDiffable>, Cell : UICollectionViewCell *> : IGListSectionControllerSwift
class ListBindingSingleSectionController<ViewModel, Cell> : ListSectionController where ViewModel : ListDiffable, Cell : UICollectionViewCell -
This
UICollectionViewsubclass allows for partial layout invalidation usingIGListCollectionViewLayout, or custom layout classes that conform to IGListCollectionViewLayoutCompatible.See moreNote
When updating a collection view (ex: calling-insertSections),-invalidateLayoutWithContextgets called on the layout object. However, the invalidation context doesn’t provide details on which index paths are being modified, which typically forces a full layout re-calculation.IGListCollectionViewgivesIGListCollectionViewLayoutthe missing information to re-calculate only the modified layout attributes.Declaration
Objective-C
@interface IGListCollectionView : UICollectionViewSwift
class ListCollectionView : UICollectionView -
This UICollectionViewLayout subclass is for vertically or horizontally scrolling lists of data with variable widths and heights. It supports an infinite number of sections and items. All work is done on the main thread, and while extremely efficient, care must be taken not to stall the main thread in sizing delegate methods.
This layout piggybacks on the mechanics of UICollectionViewFlowLayout in that:
- Your UICollectionView data source must also conform to UICollectionViewDelegateFlowLayout
- Header support given via UICollectionElementKindSectionHeader
All UICollectionViewDelegateFlowLayout methods are required and used by this layout:
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath; - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section; - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section; - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section; - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;In a vertically scrolling layout, sections and items are put into the same horizontal row until the max-x position of an item extends beyond the width of the collection view. When that happens, the item is “newlined” to the next row. The y position of that row is determined by the maximum height (including section insets) of the section/item of the previous row.
Ex. of a section (2,0) with a large width causing a newline.
|[ 0,0 ][ 1,0 ] | |[ 2,0 ]|A section with a non-zero height header will always cause that section to newline. Headers are always stretched to the width of the collection view, pinched with the section insets.
Ex. of a section (2,0) with a header inset on the left/right.
|[ 0,0 ][ 1,0 ] | | >======header=======< | | [ 2,0 ] |Section insets apply to items in the section no matter if they begin on a new row or are on the same row as a previous section.
Ex. of a section (2) with multiple items and a left inset.
|[ 0,0 ][ 1,0 ] >[ 2,0 ]| | >[ 2,1 ][ 2,2 ][ 2,3 ]|Interitem spacing applies to items and sections within the same row. Line spacing only applies to items within the same section.
In a horizontally scrolling layout, sections and items are flowed vertically until they need to be “newlined” to the next column. Headers, if used, are stretched to the height of the collection view, minus the section insets.
Please see the unit tests for more configuration examples and expected output.
See moreDeclaration
Objective-C
@interface IGListCollectionViewLayout : UICollectionViewLayout <IGListCollectionViewLayoutCompatible>Swift
class ListCollectionViewLayout : UICollectionViewLayout, ListCollectionViewLayoutCompatible -
This class adds a helper layer to
See moreIGListSectionControllerto automatically store a generic object indidUpdateToObject:.Declaration
Objective-C
@interface IGListGenericSectionController<__covariant ObjectType> : IGListSectionControllerSwift
class ListGenericSectionController<ObjectType> : ListSectionController where ObjectType : AnyObject -
An
IGListReloadDataUpdateris a concrete type that conforms toIGListUpdatingDelegate. It is an out-of-box updater forIGListAdapterobjects to use.Note
This updater performs simple, synchronous updates using-[UICollectionView reloadData].Declaration
Objective-C
@interface IGListReloadDataUpdater : NSObject <IGListUpdatingDelegate>Swift
class ListReloadDataUpdater : NSObject, ListUpdatingDelegate -
The base class for section controllers used in a list. This class is intended to be subclassed.
See moreDeclaration
Objective-C
@interface IGListSectionController : NSObjectSwift
class ListSectionController : NSObject -
This section controller is meant to make building simple, single-cell lists easier. By providing the type of cell, a block to configure the cell, and a block to return the size of a cell, you can use an
See moreIGListAdapter-powered list with a simpler architecture.Declaration
Objective-C
@interface IGListSingleSectionController : IGListSectionControllerSwift
class ListSingleSectionController : ListSectionController -
Container object that holds the data needed for an update.
See moreDeclaration
Objective-C
@interface IGListTransitionData : NSObjectSwift
class ListTransitionData : NSObject
View on GitHub
Classes Reference