uicollectionviewdiffabledatasource

UICollectionViewDiffableDataSource: Request for number of items in section 0 when there are only 0 sections in the collection view

点点圈 提交于 2021-02-10 17:45:55
问题 I am trying to make a timeline where each section is a day and each day has many items (records). Here is my section (day) class: class YearMonthDay: Comparable, Hashable { let year: Int let month: Int let day: Int init(year: Int, month: Int, day: Int) { self.year = year self.month = month self.day = day } init(date: Date) { let comps = Calendar.current.dateComponents([.year, .month, .day], from: date) self.year = comps.year! self.month = comps.month! self.day = comps.day! } func hash(into

diffable data source section header blinks during update

我与影子孤独终老i 提交于 2021-01-05 13:19:37
问题 I'm currently facing the issue, that when applying a new snapshot to my current data source, that the header, footer and decoration views are not part of the collection view's subviews, which can be noticed as a weird flicker. Did anyone face that issue before? I update the data source via: var snapshot = NSDiffableDataSourceSnapshot<Section, Item>() snapshot.appendSections(Sections.allCases) items.forEach { snapshot.appendItems([$0], toSection: ItemSectionMapper.getSection(for: $0)) } self

diffable data source section header blinks during update

社会主义新天地 提交于 2021-01-05 13:18:47
问题 I'm currently facing the issue, that when applying a new snapshot to my current data source, that the header, footer and decoration views are not part of the collection view's subviews, which can be noticed as a weird flicker. Did anyone face that issue before? I update the data source via: var snapshot = NSDiffableDataSourceSnapshot<Section, Item>() snapshot.appendSections(Sections.allCases) items.forEach { snapshot.appendItems([$0], toSection: ItemSectionMapper.getSection(for: $0)) } self