AdministrativeRulesLoader

public class AdministrativeRulesLoader
extension AdministrativeRulesLoader: NativeBase
extension AdministrativeRulesLoader: Hashable

Provides the protocol for the access to the administrative rules available for a country or a state in the local OCM map. Please be aware that the methods within this classload map data synchronously. In the event of absent data in the disk cache, the data will be retrieved from the remote server. To mitigate the potential freezing of the calling thread, it is advisable to proactively prefetch map data around the working area.

Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

  • Creates a new instance of this class.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init() throws
  • Creates a new instance of this class.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init(sdkEngine: SDKNativeEngine) throws

    Parameters

    sdkEngine

    A SDKEngine instance.

  • Synchronously loads the list of state codes from a specified country for which administrative rules are availabe. These state codes can then be used to get specific administrative rules for a specified state using the get_administrative_rules() method. Returns a list with all the state codes available in the country. In case the country has no states, the list will be empty.

    Throws

    MapDataLoaderError Specifies reason, why the list of state codes was not returned.

    Declaration

    Swift

    public func getStateCodes(countryCode: CountryCode) throws -> [String]

    Parameters

    countryCode

    The country code for which the state codes are going to be retrieved.

    Return Value

    The list of state codes present in the country for which administrative rules are available. Throws if it’s not possible to return the list of state codes.

  • Synchronously load the administrative rules for the specified country and state. Note: The state_code parameter can be set to nil. In this case, even if the country has multiple states, each with their own administrative rules, an AdministrativeRules object will be returned, containing the administrative rules valid for the entire country. These rules can however be overwritten by the state rules when the driver is in that specific state, so it is recommended to always retrieve the rules for a specific state for higher accuracy. Returns an AdministrativeRules object which contains the administrative rules for the specified country and state.

    Throws

    MapDataLoaderError Specifies reason, why the administrative rules were not retrieved.

    Declaration

    Swift

    public func getAdministrativeRules(countryCode: CountryCode, stateCode: String?) throws -> AdministrativeRules

    Parameters

    countryCode

    The country code for which the administrative rules will be retrieved.

    stateCode

    The state name for which the administrative rules will be received. It can be nil.

    Return Value

    Requested administrative rules for the country and the state specified.