OfflineStructuredSearchSession
@available(*, deprecated, message: "This API is deprecated and will be removed with the next major release.")
public final class OfflineStructuredSearchSession : StructuredSearchSession
extension OfflineStructuredSearchSession: StoreAccessChangedObserver
StructuredSearchSession implementation that uses offline map data.
For more information, see StructuredSearchSession
.
Fetch the current structured search state. This can be used to retrieve the initial state with candidates representing the top level of address, such as country.
Declaration
Swift
public func fetchStructuredSearchState(completion: @escaping (Result<StructuredSearchResponse, Error>) -> ())
Parameters
completion
|
The completion closure is called after the response to the request has been processed.
If no errors occurred, |
Go back to previous selection from current step.
step
must be a positive value.
If step
is larger than the number of steps that have been taken,
e.g. goBack
is called with step
set to 9 at the third step, it goes back to the first step.
Declaration
Swift
public func goBack(step: Int, completion: @escaping (Result<StructuredSearchResponse, Error>) -> ())
Parameters
step
|
The number of step to go back. |
completion
|
The completion closure is called after the response to the request has been processed.
If no errors occurred, |
Notification that read-only (shared) access to the map files was granted to the user.
This notification is received when the observer is registered to NDSStoreAccessSync
, if
the map is available at that time, and also every time the map becomes available again
(typically, after a component with write access finishes modifying the map and reverts to
read-only access). Upon receiving this notification, the observer should initialize/reset
their internal state that depends on map data, in all cases except one: when their
map-dependent internal state is already initialized AND mapChanged
is equal to false.
Warning
A user with read-only access must not modify the map files in any way!Declaration
Swift
public func onReadOnlyAccessGranted(mapChanged: Bool)
Parameters
mapChanged
|
|
Notification that read-only access to the map is being revoked (usually because the map needs to be updated or otherwise modified).
The observer should stop all operations which access the map and invoke the callback
provided as the first parameter to signal it has done so (and after invoking it, it no longer
has any kind of access to the map!). If it is not possible to stop any ongoing operations,
the observer can save the callback and call it later, after its operations have finished
(unless it receives onReadOnlyAccessGranted
in the meantime, which means that shared access
is no longer being revoked).
In either case, the implementation of onReadOnlyAccessReleaseRequested
should return as
quickly as possible and not stall.
Declaration
Swift
public func onReadOnlyAccessReleaseRequested(accessReleased: @escaping AccessReleaseCallback)
Parameters
accessReleased
|
a function or function-like object which should be called by the user after it stops accessing the map files to signal that it has released access to the map. |
Select a specific candidate in the current step. This will advance to the next step of the search path.
Declaration
Swift
public func selectCandidate(
candidate: StructuredSearchCandidate,
completion: @escaping (Result<StructuredSearchResponse, Error>) -> ()
)
Parameters
candidate
|
The candidate to select in the current step. |
completion
|
The completion closure is called after the response to the request has been processed.
If no errors occurred, |
Set locale for the search session.
The locale is used to find the best representation of strings in StructuredSearchCandidate
.
Declaration
Swift
public func setLocale(locale: Locale, completion: @escaping (Result<StructuredSearchResponse, Error>) -> ())
Parameters
locale
|
The preferred |
completion
|
The completion closure is called after changing locale has been finished.
If no errors occurred, |
A string that can be used to identify the observer.
This will be used only for logging purposes, so there are no strict rules on what it should look like, but a descriptive and unique name would be best for log readability.
Declaration
Swift
public var storeAccessChangedObserverID: String { get }