BrowseIterator
@objcMembers
public class BrowseIterator : NSObject
Iterator to browse all index content.
This helper takes care of chaining API requests and calling back the completion handler with the results, until:
- the end of the index has been reached;
- an error has been encountered;
- or the user cancelled the iteration.
-
The index being browsed.
Declaration
Swift
public let index: Index
-
The query used to filter the results.
Declaration
Swift
public let query: Query
-
Construct a new browse iterator.
Note
The iteration does not start automatically. You have to call
start()
explicitly.Declaration
Swift
@objc public init(index: Index, query: Query, completionHandler: @escaping BrowseIteratorHandler)
Parameters
index
The index to be browsed.
query
The query used to filter the results.
completionHandler
Handler called for each page of results.
-
Start the iteration.
Declaration
Swift
@objc public func start()
-
Cancel the iteration. This cancels any currently ongoing request, and cancels the iteration. The completion handler will not be called after the iteration has been cancelled.
Declaration
Swift
@objc public func cancel()
-
Determine if there is more content to be browsed.
Warning
Can only be called from the handler, once the iteration has started.Declaration
Swift
@objc public func hasNext() -> Bool