I tried this POC in enumerateItems delegate, which simulates paging.
Isn't it suppose to show the files as soon finishEnumerating upTo is triggered?
The files are shown only after finishEnumerating(upTo: nil) is called, if there are 20 pages then it will wait for 20 pages info then only the files will be listed in the Finder!
How to solve this? or Did I miss something?
func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) {
if(page.toInt64() == 100){
observer.didEnumerate([FileProviderItem(identifier: NSFileProviderItemIdentifier(rawValue: "paging.txt"))])
DispatchQueue.main.asyncAfter(deadline: .now() + 15) {
observer.finishEnumerating(upTo: nil)
}
return
}
observer.didEnumerate([FileProviderItem(identifier: NSFileProviderItemIdentifier(rawValue: "a.txt"))])
observer.didEnumerate([FileProviderItem(identifier: NSFileProviderItemIdentifier(rawValue: "b.txt"))])
observer.didEnumerate([FileProviderItem(identifier: NSFileProviderItemIdentifier(rawValue: "c.txt"))])
observer.didEnumerate([FileProviderItem(identifier: NSFileProviderItemIdentifier(rawValue: "d.txt"))])
observer.finishEnumerating(upTo: NSFileProviderPage(100))
}