LocalDataProvider
public class LocalDataProvider<Record> : IndexableDataProvider where Record : IndexableRecord, Record : SearchResult, Record : Decodable, Record : Encodable
Search records data provider with local storage
-
NSNotification name for built-in update notifications.
Declaration
Swift
public static var updateNotificationName: Notification.Name { get } -
Provider identifier for concrete local provider
Declaration
Swift
public static var providerIdentifier: String { get } -
Dictionary with all records
Declaration
Swift
public var recordsMap: [String : Record] -
Determines if entries from the provider are added to search results
Declaration
Swift
public var addsRecordsToInteractors: Bool -
Records storage
Declaration
Swift
public let persistentService: CodablePersistentService<[Record]>? -
Make your own data provider of local data with built-in load/save support for Codable results.
Declaration
Swift
public init() -
Register custom data provider interactor to notify search engine about object additions or changes.
Declaration
Swift
public func registerProviderInteractor(interactor providerInteractor: RecordsProviderInteractor) -
Resolves SearchResultSuggestion into SearchResult locally.
Declaration
Swift
public func resolve(suggestion: SearchResultSuggestion, completion: (SearchResult?) -> Void)Parameters
suggestionsuggestion to resolve
completioncompletion closure
-
Resolves
SearchResultSuggestionintoSearchResultlocally.Declaration
Swift
public func resolve( suggestion: any SearchResultSuggestion, retrieveOptions: RetrieveOptions?, completion: @escaping ((any SearchResult)?) -> Void )Parameters
suggestionsuggestion to resolve
retrieveOptionsDefine attribute sets to request additional metadata attributes
completioncompletion closure
-
Adds record to providers storage
Declaration
Swift
public func add(record: Record)Parameters
recordentity to add
-
Add or override existoing record to provireds storage
Declaration
Swift
public func update(record: Record)Parameters
recordentirny to update
-
Deletes record by id
Declaration
Swift
public func delete(recordId: String)Parameters
recordIdrecord id to delete
-
Deletes all records
Declaration
Swift
public func deleteAll()
LocalDataProvider Class Reference