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
suggestion
suggestion to resolve
completion
completion closure
-
Resolves
SearchResultSuggestion
intoSearchResult
locally.Declaration
Swift
public func resolve( suggestion: any SearchResultSuggestion, retrieveOptions: RetrieveOptions?, completion: @escaping ((any SearchResult)?) -> Void )
Parameters
suggestion
suggestion to resolve
retrieveOptions
Define attribute sets to request additional metadata attributes
completion
completion closure
-
Adds record to providers storage
Declaration
Swift
public func add(record: Record)
Parameters
record
entity to add
-
Add or override existoing record to provireds storage
Declaration
Swift
public func update(record: Record)
Parameters
record
entirny to update
-
Deletes record by id
Declaration
Swift
public func delete(recordId: String)
Parameters
recordId
record id to delete
-
Deletes all records
Declaration
Swift
public func deleteAll()