ListDiffable
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (7), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
insertItemsAtIndexPaths:
updateItemsAtIndexPaths:
deleteItemsAtIndexPaths:
collectionView.reloadData()😅
func diffIdentifier() -> NSObjectProtocol
func isEqual(toDiffableObject object: ListDiffable?) -> Bool
class Message {
var messageId: String
var content: String
var senderName: String
init(messageId: String, content: String, senderName: String) {
self.messageId = messageId
self.content = content
self.senderName = senderName
}
}
extension Message: ListDiffable {
func diffIdentifier() -> NSObjectProtocol {
return messageId as NSObjectProtocol
}
func isEqual(toDiffableObject object: ListDiffable?) -> Bool {
guard let object = object as? Message else { return false }
return content == object.content && senderName == object.senderName
}
}
[ListDiffable]
IGListAdapter
IGListSectionController
UICollectionViewCell
objectsForListAdapter:
listAdapter:sectionControllerForObject:
emptyViewForListAdapter:
numberOfItems
minimumLineSpacing
minimumInterimSpacing
sizeForItemAt:
cellForItemAt:
didUpdateToObject:
didSelectItemAt:
didDeselectItemAt: