AI-generated Key Takeaways
-
GMSNavigationNavInfoprovides real-time navigation state information, including the current step, remaining steps, and route changes. -
It offers estimated time and distance to the next step and the final destination.
-
Includes helper methods for rounding time and distance values for user-friendly display.
-
Provides formatted instructions for navigation steps using
GMSNavigationInstructionOptions. -
It's an essential object for building navigation experiences with the Google Maps SDK for iOS.
GMSNavigationNavInfo
@interface GMSNavigationNavInfo : NSObjectContains information about the state of navigation
-
The current
GMSNavigationNavStatefor navigation.Declaration
Swift
var navState: GMSNavigationNavState { get }Objective-C
@property (nonatomic, readonly) GMSNavigationNavState navState; -
Information about the upcoming maneuver step. This is only set if the navState is
GMSNavigationNavStateEnrouteand will be null otherwise.Declaration
Swift
var currentStep: GMSNavigationStepInfo? { get }Objective-C
@property (nonatomic, readonly, nullable) GMSNavigationStepInfo *currentStep; -
The remaining steps after the current step.
Declaration
Swift
var remainingSteps: [GMSNavigationStepInfo] { get }Objective-C
@property (nonatomic, readonly) NSArray<GMSNavigationStepInfo *> *_Nonnull remainingSteps; -
Whether the route has changed since the last sent message. A route change may be caused by a reroute, the addition/removal of a waypoint, the user selecting or driving onto an alternate route, or a traffic update.
Declaration
Swift
var routeChanged: Bool { get }Objective-C
@property (nonatomic, readonly) BOOL routeChanged; -
The estimated remaining time in seconds along the route to the current step.
Declaration
Swift
var timeToCurrentStepSeconds: TimeInterval { get }Objective-C
@property (nonatomic, readonly) NSTimeInterval timeToCurrentStepSeconds; -
The estimated remaining distance in meters along the route to the current step .
Declaration
Swift
var distanceToCurrentStepMeters: CLLocationDistance { get }Objective-C
@property (nonatomic, readonly) CLLocationDistance distanceToCurrentStepMeters; -
The estimated remaining time in seconds to the final destination.
Declaration
Swift
var timeToFinalDestinationSeconds: TimeInterval { get }Objective-C
@property (nonatomic, readonly) NSTimeInterval timeToFinalDestinationSeconds; -
The estimated remaining distance in meters to the final destination.
Declaration
Swift
var distanceToFinalDestinationMeters: CLLocationDistance { get }Objective-C
@property (nonatomic, readonly) CLLocationDistance distanceToFinalDestinationMeters; -
Returns a time rounded to the nearest minute, with a minimum of one minute.
This can be useful when displaying route information to users, since it can be confusing to display times such a “0 min”.
Due to the above, input values to this method should always be positive.
Declaration
Swift
func roundedTime(_ timeSeconds: TimeInterval) -> TimeIntervalObjective-C
- (NSTimeInterval)roundedTime:(NSTimeInterval)timeSeconds; -
Returns a rounded measurement representing the given distance, taking into account user preferences and the recommended distance unit for the route.
Declaration
Swift
func roundedDistance(_ distanceMeters: CLLocationDistance) -> Measurement<UnitLength>Objective-C
- (nonnull NSMeasurement<NSUnitLength *> *)roundedDistance: (CLLocationDistance)distanceMeters; -
The formatted instructions for the given step.
Declaration
Swift
func instructions(forStep stepInfo: GMSNavigationStepInfo, options: GMSNavigationInstructionOptions) -> [NSAttributedString]Objective-C
- (nonnull NSArray<NSAttributedString *> *) instructionsForStep:(nonnull GMSNavigationStepInfo *)stepInfo options:(nonnull GMSNavigationInstructionOptions *)options; -
Unavailable
Declaration
Objective-C
- (null_unspecified instancetype)init NS_UNAVAILABLE;