diff --git a/Sources/Extensions/AppKitExtension.swift b/Sources/Extensions/AppKitExtension.swift index 0570448..4c9068e 100644 --- a/Sources/Extensions/AppKitExtension.swift +++ b/Sources/Extensions/AppKitExtension.swift @@ -131,6 +131,22 @@ public extension NSCollectionView { animator().performBatchUpdates({ setData(changeset.data) + if !changeset.sectionDeleted.isEmpty { + deleteSections(IndexSet(changeset.sectionDeleted)) + } + + if !changeset.sectionInserted.isEmpty { + insertSections(IndexSet(changeset.sectionInserted)) + } + + if !changeset.sectionUpdated.isEmpty { + reloadSections(IndexSet(changeset.sectionUpdated)) + } + + for (source, target) in changeset.sectionMoved { + moveSection(source, toSection: target) + } + if !changeset.elementDeleted.isEmpty { deleteItems(at: Set(changeset.elementDeleted.map { IndexPath(item: $0.element, section: $0.section) })) }