VehicleActions

public protocol VehicleActions

Defines available actions according to vehicle restriction feature.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Updates vehicle. If StyleDefinition.vehicleRestrictionsLight or StyleDefinition.vehicleRestrictionsDark, restrictions will become visible.

    Declaration

    Swift

    func updateVehicle(_ vehicle: any Vehicle)

    Parameters

    vehicle

    The new Vehicle.

  • Shows vehicle restriction for given vehicle provided. It is required that map.styleContainer = .restrictionsStyle is set for online vehicle restrictions.

    For offline StyleContainer using OfflineStyleURLProvider should be used.

    let mainStyle = StyleDefinition.custom(
        style: OfflineStyleURLProvider.vehicleRestrictionsLightStyleURL,
        layerMapping: OfflineStyleURLProvider.layerMappingURL)
    
    let darkStyle = StyleDefinition.custom(
        style: OfflineStyleURLProvider.vehicleRestrictionsDarkStyleURL,
        layerMapping: OfflineStyleURLProvider.layerMappingURL)
    
    map.styleContainer = StyleContainer(mainStyle: mainStyle,
                                        darkStyle: darkStyle,
                                        bundle: resourceBundle)
    

    Throws

    An error if vehicle restrictions cannot be shown.

    Declaration

    Swift

    func showVehicleRestrictions(vehicle: any Vehicle) throws

    Parameters

    vehicle

    The Vehicle.

  • Shows vehicle restrictions layers if hidden previously.

    Declaration

    Swift

    func showVehicleRestrictions() throws
  • Hides vehicle restrictions layers.

    Declaration

    Swift

    func hideVehicleRestrictions()