Questions tagged [uicollectionviewdiffabledatasource]
75 questions
0
votes
2 answers
NSDiffableDataSource - the cellProvider on my CollectionView Data Source is not being called?
I have a data source like so
fileprivate func makeRecordsDataSource() -> RecordsDataSource {
let dataSource = RecordsDataSource(
collectionView: recordsCollectionView,
cellProvider: { (collectionView, indexPath,…

BigBoy1337
- 4,735
- 16
- 70
- 138
0
votes
0 answers
Is it possible to adapt UIcollectionViewCompositionalLayout for different Sized cells dequeued by diffableDataSource
I have a horizontal scrolling collectionView that I need to modify from dequeuing 1 type of cell, to two types of cell with two different fixed widths (both have the same height but one has a greater width).
I've modified my dataSource to dequeue…

Shyne
- 1
- 2
0
votes
0 answers
How to ignore duplicates on UICollectionViewDiffableDataSource?
So for testing purposes and following an online tutorial, I made an extremely simple app that Presents an action sheet with the ability to add one fruit.
Current model code:
enum Section {
case main
}
struct Fruit: Hashable {
let uuid =…

stompy
- 227
- 1
- 13
0
votes
1 answer
Objective-C Hashable object for Diffable Data Source
I am trying to implement a collection view with a diffable data source in Objective-C. I know for Swift, the generic types for UICollectionViewDiffableDataSource are types that conform to both the Hashable and Identifiable protocols. But I do not…

ashipma
- 423
- 5
- 15
0
votes
1 answer
Is applying NSDiffableDataSourceSnapshot broken?
I have a problem with applying NSDiffableDataSourceSnapshot to UICollectionViewDiffableDataSource. Imagine this situation: I have two items and I want to remove the second one and also I want to reload all other items in that section.
I do it like…

Robert Dresler
- 10,580
- 2
- 22
- 40
0
votes
1 answer
Using both NSDiffableDataSourceSnapshot and NSDiffableDataSourceSectionSnapshot can cause assertion failures in UICollectionView when reordering cells
I am using diffable data sources in a UICollectionView using a layout of UICollectionViewCompositionalLayout.list. My collection view supports reordering of cells via reorderingHandlers on the UICollectionViewDiffableDataSource. Additionally, I am…

Andrew Bennet
- 2,600
- 1
- 21
- 55
0
votes
1 answer
Swift Diffable datasource will crash when Firebase .observe() updates values
I am building an app where a user can read articles. Each article is written by an author, so, on the article view, when the user clicks on the author's profile picture it navigates to the Author's profile view.
In the Author Profile view, there is…

christostsang
- 1,701
- 3
- 27
- 46
0
votes
1 answer
Swift Diffable Snapshot - Add new Section to Snapshot and Reload Collection View
I have a collection view that has sections and the beginning. I want to add a new section after the user creates data and display data in the new section. Here is the code I have tried but failed. The new section does not appear after running the…

firattamur
- 422
- 4
- 13
0
votes
0 answers
How to update realm with diffabledatasource?
I'm new to realm and trying to implement realm with UICollectionViewDiffableDataSource. However, I'm finding it difficult to update the data source after inserting / deleting a new object. I tried to update with NotificationToken but it crashes.…

Mohit
- 45
- 2
- 10
0
votes
1 answer
UICollectionView: Animate cell while scrolling
I want to animate the top and bottom most cells in a UICollectionView as they enter and leave the screen. I don't just want to animate using scrollview delegates and a one time animation. I want the animations to be progress driven.
Example: Top…

bdodge
- 1
- 1
0
votes
1 answer
UICollectionViewDiffableDataSource doesn't animate properly on apply
I have a list of items, they are displayed in decreasing order by amount in a list. I hash them by name, so when I change the amounts, they should reorder smoothly on apply.
When I call the apply(snapshot, animatingDifferences: true) function on…

Bence Pattogato
- 3,752
- 22
- 30
0
votes
1 answer
Stretchy Header in UICollectionViewCompositionalLayout in ios 14?
How can I override layoutAttributesForElements in UICollectionViewCompositionalLayout ?
func createCompositionalLayout() -> UICollectionViewLayout {
let layout = UICollectionViewCompositionalLayout { sectionIndex, layoutEnvironment in
…

rupesh45
- 125
- 2
- 8
0
votes
2 answers
Crash Supplied identifiers are not unique
I have a searchController, when I try to delete the text in searchController it crash the message is.
supplied identifiers are not unique
I try to fix it with hasher function like this and make my model Hashable, and Equatable. but still not fix…

ferryawijayanto
- 569
- 4
- 18
0
votes
1 answer
UITableViewDiffableDataSource and UICollectionViewDiffableDataSource working different when class vs struct is used
I noticed, when using UITableViewDiffableDataSource / UICollectionViewDiffableDataSource, the ItemIdentifierType
when using
var managedDataSource: UITableViewDiffableDataSource!
class StringCellObject: Hashable {
let…

Peter Lapisu
- 19,915
- 16
- 123
- 179
-1
votes
0 answers
How to combine two different models to use as UICollectionViewDiffableDataSource?
I have a FridgeVC inside which I search for some ingredients and add them to the selectedIngredients array. For this I use Ingredient model. and also I have a childVC there. On childVC I have findRecipes button. For now I can search for ingredients…

asduskun
- 17
- 5