Navigator
public class Navigator : NavigatorProtocol
extension Navigator: NativeBase
extension Navigator: Hashable
This class provides the basic navigation functionality. It provides
notifications about current map-matched location updates (see NavigableLocation).
And, if a route has been set, about the route progress (see RouteProgress),
route deviations (see RouteDeviation) and maneuver notifications (see
EventTextDelegate).
All transport modes are supported for turn-by-turn navigation, except for public transit. Public transit routes may lead to unsafe and unexpected results.
Navigation support for bus routes can be sometimes a bit limited and bus lane assistance and turn-by-turn bus instructions may not be as appropriate as expected.
The TransportMode is determined from the provided Route instance,
but the actual SectionTransportMode can vary along a route, for example, when a
ferry must be taken. When no route is set, the NavigableLocation assumes a drive
scenario.
This class continuously reacts to new locations provided from a location source and acts as a
LocationDelegate.
The accuracy of the positioning increases with the update frequency. At least one update per second
should be provided. More information can be found at LocationAccuracy.NAVIGATION.
Note:
Even without provided locations, for example, while driving through a tunnel, this class
can interpolate missing location events and still send NavigableLocation,
RouteProgress and maneuver notifications.
-
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init() throws -
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(sdkEngine: SDKNativeEngine) throwsParameters
sdkEngineA SDKEngine instance.
-
The route to navigate. Gets and sets the route that is being navigated. If not set, only the current location information will be provided through
NavigableLocationDelegate. If set, both route progress (RouteProgressDelegate) and route deviation (RouteDeviationDelegate) will receive notifications on updates. A route may fail to be set if it is generated by an incompatible engine, in which case the operation has no effect.Declaration
Swift
public var route: Route? { get set } -
Defines the transport profile for the
Navigator, when no route is present. Properly setting the transport profile optimizes the navigation experience, and improves resource consumption. For example, aTransportProfilecan be defined with aVehicleProfile. A vehicle profile can have several parameters such asVehicleTypeto set the source of information describing the vehicle. The default is aVehicleType.carprofile.Currently used members of
TransportProfileVehicleType: Sets the transport mode.- From
vehicleProfile:grossWeightInKilograms: Required for truck related speed information.heightInCentimeters: Required for truck related speed information.widthInCentimeters: Additional truck definition for more specific truck speed information.lengthInCentimeters: Additional truck definition for more specific truck speed information.
Declaration
Swift
public var trackingTransportProfile: TransportProfile? { get set } -
Object to receive notifications about the current location. It returns
nilwhen no delegate is set by an user.Declaration
Swift
public weak var navigableLocationDelegate: NavigableLocationDelegate? { get set } -
Object to receive notifications about navigation route progress. Route progress notifications only occurs if the route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var routeProgressDelegate: RouteProgressDelegate? { get set } -
Object to receive notifications about deviations from the route if any occurs. Route deviation notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var routeDeviationDelegate: RouteDeviationDelegate? { get set } -
Object to receive text notifications when they are available. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user. Note: In order to receive the text notification emitted for the traffic merge warner, whenTrafficMergeWarningOptions.enable_text_notificationhas been enabled, thesdk.navigation.EventTextListenermust be enabled as well.Declaration
Swift
public weak var eventTextDelegate: EventTextDelegate? { get set } -
Object to receive notifications about the arrival at each
Milestoneor missing it. It informs on all waypoints (passed or missed) that are of typeMilestoneType.stopoverbut excludes the starting waypoint. Waypoints of typeMilestoneType.passthroughare excluded, by default, but can be included viaisPassthroughWaypointsHandlingEnabled. Milestone status notifications only occurs if a route has been set. Settingnilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var milestoneStatusDelegate: MilestoneStatusDelegate? { get set } -
Object to receive the notification about the arrival at the destination. Destination reached notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var destinationReachedDelegate: DestinationReachedDelegate? { get set } -
Object to receive notifications when a speed limit on a road is exceeded or driving speed is restored back to normal. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var speedWarningDelegate: SpeedWarningDelegate? { get set } -
Object to receive maneuver view lane assistance notifications. Maneuver view lane assistance notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var maneuverViewLaneAssistanceDelegate: ManeuverViewLaneAssistanceDelegate? { get set } -
Object to receive current situation lane assistance view notifications. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var currentSituationLaneAssistanceViewDelegate: CurrentSituationLaneAssistanceViewDelegate? { get set } -
Object to receive notification on approaching environmental zones. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var environmentalZoneWarningListenerDelegate: EnvironmentalZoneWarningDelegate? { get set } -
Object to receive junction view lane assistance notifications. Junction view lane assistance notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var junctionViewLaneAssistanceDelegate: JunctionViewLaneAssistanceDelegate? { get set } -
Object to receive safety camera warner notifications. If a delegate delegate is present, notifications about safety speed cameras will be also sent via
SafetyCameraWarningDelegate. Settingnilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var safetyCameraWarningDelegate: SafetyCameraWarningDelegate? { get set } -
Safety camera warning options to be passed to
SafetyCameraWarningDelegate. These options allow the enabling or disabling the text notification for the warner.Declaration
Swift
public var safetyCameraWarningOptions: SafetyCameraWarningOptions { get set } -
Object to receive notification on approaching danger zones. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var dangerZoneWarningListenerDelegate: DangerZoneWarningDelegate? { get set } -
Object to receive notifications about truck restrictions on the current road. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var truckRestrictionsWarningDelegate: TruckRestrictionsWarningDelegate? { get set } -
Truck restrictions warning options that allow to filter truck restrictions to be passed to
TruckRestrictionsWarningDelegate.Declaration
Swift
public var truckRestrictionsWarningOptions: TruckRestrictionsWarningOptions { get set } -
Object to receive post action notifications, such as a charge action at a charging station. Post actions notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var postActionDelegate: PostActionDelegate? { get set } -
Object to receive notifications about the speed limit of the current road. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var speedLimitDelegate: SpeedLimitDelegate? { get set } -
Object to receive notifications about the textual attributes of the current road. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var roadTextsDelegate: RoadTextsDelegate? { get set } -
Object to receive notifications about attributes of the current road. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var roadAttributesDelegate: RoadAttributesDelegate? { get set } -
Object to receive notifications about road signs on the current road. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var roadSignWarningDelegate: RoadSignWarningDelegate? { get set } -
Road sign warning options that allow to filter road sings to be passed to
RoadSignWarningDelegate.Declaration
Swift
public var roadSignWarningOptions: RoadSignWarningOptions { get set } -
Object to receive notifications about school zones on the current road. Setting
nilvalue to the delegate will unset the delegate. school zones on the current road. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var schoolZoneWarningDelegate: SchoolZoneWarningDelegate? { get set } -
School zone warning options It allow to configure school zone notifications to be passed to
SchoolZoneWarningDelegate.Declaration
Swift
public var schoolZoneWarningOptions: SchoolZoneWarningOptions { get set } -
Object to receive notifications about junction views on the current road. Setting
nilvalue to the delegate will unset the delegate. This feature requires a map version greater or equal to 67 in order to function properly. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var realisticViewWarningDelegate: RealisticViewWarningDelegate? { get set } -
Realistic view warning options. It allow to filter realistic views to be passed to
RealisticViewWarningDelegate.- This feature requires a map version greater or equal to 67 in order to function properly.
Declaration
Swift
public var realisticViewWarningOptions: RealisticViewWarningOptions { get set } -
Object to receive notifications about border crossings on the current road. Border crossing notifications are given only if a route is present. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var borderCrossingWarningDelegate: BorderCrossingWarningDelegate? { get set } -
Border crossing warning options to be passed to
BorderCrossingWarningDelegate. These options allow the filtering of the border crossing warnings received and set the notification distances.Declaration
Swift
public var borderCrossingWarningOptions: BorderCrossingWarningOptions { get set } -
Object to receive information on the upcoming toll stop. Setting
nilvalue to the delegate will unset the delegate. 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.Declaration
Swift
public weak var tollStopWarningDelegate: TollStopWarningDelegate? { get set } -
Object to receive notifications about railway crossings on the current road. Railway crossing notifications are given regardless if a route is set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var railwayCrossingWarningDelegate: RailwayCrossingWarningDelegate? { get set } -
Object to receive notifications about low speed zones on the current road. Low speed zone notifications are given regardless if a route is set. This delegate is currently available only for Japan. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var lowSpeedZoneWarningDelegate: LowSpeedZoneWarningDelegate? { get set } -
Object to receive notifications about merging traffic to the current road. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public weak var trafficMergeWarningDelegate: TrafficMergeWarningDelegate? { get set } -
Merging traffic warning options that allow to configure merging traffic notifications to be passed to
TrafficMergeWarningDelegate.Declaration
Swift
public var trafficMergeWarningOptions: TrafficMergeWarningOptions { get set } -
Object to receive the notification about the arrival at the off-road destination. Off-road destination reached notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public var offRoadDestinationReachedDelegate: OffRoadDestinationReachedDelegate? { get set } -
Object to receive the notification about the off-road progress. Off-road progress notifications only occurs if a route has been set. Setting
nilvalue to the delegate will unset the delegate. It returnsnilwhen no delegate is set by an user.Declaration
Swift
public var offRoadProgressDelegate: OffRoadProgressDelegate? { get set } -
Options used for maneuver notifications. Notifications are only available if a route is present.
Declaration
Swift
public var maneuverNotificationOptions: ManeuverNotificationOptions { get set } -
Options used for text notifications. Notifications are only available if a route is present.
Declaration
Swift
public var eventTextOptions: EventTextOptions { get set } -
Options used for the speed warning feature.
Declaration
Swift
public var speedWarningOptions: SpeedWarningOptions { get set } -
Defines whether to enable or disable tunnel extrapolation. By default the tunnel extrapolation is enabled.
Declaration
Swift
public var isEnableTunnelExtrapolation: Bool { get set } -
Defines whether to enable or disable handling of passthrough waypoints. By default the handling of passthrough waypoints is disabled.
Declaration
Swift
public var isPassthroughWaypointsHandlingEnabled: Bool { get set } -
Traffic information for the current route. This impacts
RouteProgressupdates as the duration of theSectionProgressmight change. However, the remaining distance and the route geometry will remain unchanged.Declaration
Swift
public var trafficOnRoute: TrafficOnRoute? { get set } -
Returns maneuver at the given index.
Declaration
Swift
public func getManeuver(index: Int32) -> Maneuver?Parameters
indexThe index of maneuver requested.
Return Value
The maneuver if it exists or otherwise
nil. -
Returns maneuver notification timing options with default values given the combination of transport mode and timing profile. The return value can be used as the base for configuring maneuver notification timings. Configure the relevant attributes of this object according to your preferences, and then set it by calling setManeuverNotificationTimingOptions function for the same combination of transport mode and timing profile.
Declaration
Swift
public func getManeuverNotificationTimingOptions(transportMode: TransportMode, timingProfile: TimingProfile) -> ManeuverNotificationTimingOptionsParameters
transportModeThe transport mode of the timing options.
timingProfileThe timing profile of the timing options.
Return Value
The timing options with default values.
-
Set timing option values for the combination of transport mode and timing profile.
Declaration
Swift
@discardableResult public func setManeuverNotificationTimingOptions(transportMode: TransportMode, timingProfile: TimingProfile, options: ManeuverNotificationTimingOptions) -> BoolParameters
transportModeThe transport mode of the timing options.
timingProfileThe timing profile of the timing options.
optionsThe timing options.
Return Value
Trueif set successfully,falsewhen options has invalid value, seeManeuverNotificationTimingOptionsfor more details about options. -
Returns the warning notification distances for the requested warning type. The return value can be used as the base for configuring warning notification distances. Configure the relevant attributes of this object according to your preferences, and then set it by calling
setWarningNotificationDistancesfunction with the same warning type and the modified warning notification distances object.Declaration
Swift
public func getWarningNotificationDistances(warningType: WarningType) -> WarningNotificationDistancesParameters
warningTypeThe warning type for which the notification distances will be returned.
Return Value
The notification distances for the given warning type.
-
Set the warning notification distances for the specified warning types. Note: The warning notification distances are set for most warners. This method can’t be used to set the warning notification distance for the School Zone warning type because it is applicable regardless of the timing profile. Use
NavigatorInterface.school_zone_warning_optionsinstead. Attempting to set the warning notification distances for the school zone warner using theNavigatorInterface.set_warning_notification_distancesmethod will fail and returnfalse. Always useSchoolZoneWarningOptions.warning_distance_in_metersto set the warning notification distance for the school zone warner regardless of theTimingProfile. IfNavigatorInterface.set_warning_notification_distancescould be used, this would allow for different distances to be set for each timing profile, which is undesirable. Attempting to set the warning notification distances for the traffic merge warner using theNavigatorInterface.set_warning_notification_distancesmethod will fail and returnfalse. Always useTrafficMergeWarningOptions.warning_distance_in_metersto set the warning notification distance for the traffic merge warner regardless of theTimingProfile. Using theNavigatorInterface.set_warning_notification_distancesmethod will fail and returnfalseto avoid seting different distances on each timing profile since the traffic merge warning is only applicable on highways.Declaration
Swift
@discardableResult public func setWarningNotificationDistances(warningType: WarningType, warningNotificationDistances: WarningNotificationDistances) -> BoolParameters
warningTypeThe warning type for which the warning notification distances will be set.
warningNotificationDistancesThe warning notification distances to be set for the specified warning types.
Return Value
Trueif set successfully,falsewhen the warning_type is [WarningType.SCHOOL_ZONE] or the options have invalid values, seeWarningNotificationDistancesfor more details about warning notification distances. -
Call of this function is used to trigger the navigator to repeat the last maneuver notification based on the current position.
Declaration
Swift
public func repeatLastManeuverNotification() -
This method calculates the distance between the current position and given coordinates. The coordinates must be on the polyline.
Declaration
Swift
public func calculateRemainingDistanceInMeters(coordinates: GeoCoordinates) -> Int32?Parameters
coordinatesThe geographic coordinates of the location.
Return Value
distance in meters or null if given coordinates are not on route or given coordinates were already traversed.
-
This method sets custom options that controls navigator behavior. Unsupported options are silently ignored. Undocumented options can change their meaning without going through deprecation process.
Declaration
Swift
public func setCustomOption(key: String, value: String)Parameters
keyOption name
valueNew option value
-
Called each time a new location is available. In a navigation context while using the
NavigatororVisualNavigator, it’s required to set theLocation.timeparameter for eachLocationobject so that the HERE SDK can map-match the locations properly. If theLocation.timeparameter is missing, the location will be ignored. For navigation, it is also recommended to provide thebearingandspeedparameters for eachLocationobject. Invoked on the main thread.Declaration
Swift
public func onLocationUpdated(_ location: Location)Parameters
locationCurrent location.
-
Returns the list of languages for maneuver notification currently available in the SDK.
Declaration
Swift
public static func availableLanguagesForManeuverNotifications() -> [LanguageCode]Return Value
the list of languages for maneuver notification currently available in the SDK.