Search code examples
iosfileprovider

File Provider iOS Pagination


Really confused about how works the pagination of FileProvider, Im working with the parameter startingAtpage of the method:

func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage)

And creating a new NSFileProviderPage to do the next pagination with the code:

var totalData = 51
let totalCountData = Data(bytes: &totalData,
                     count: MemoryLayout.size(ofValue: totalData))
          observer.finishEnumerating(upTo: NSFileProviderPage(rawValue: totalCountData)) 

My petitions are from 50 to 50 pagination. The File Provider only shows 28 elements but has received 50 items and later doesn't make the pagination. Is it possible to know how it works? I didn't find anything about it.


Solution

  • I've finally found the solution, the problem was when I call observer.enumeratedItems(items) the list of items some has the same "key" so some of them are duplicates but have different hash but the observer only accepts only one item with the same "key"