GMSNavigationWaypoint
@interface GMSNavigationWaypoint : NSObject <NSCopying, NSMutableCopying>An immutable waypoint class, used to specify navigation destinations. It may be initialized from
a CLLocationCoordinate2D or a Google Place ID.
-
Declaration
Swift
var title: String { get }Objective-C
@property(nonatomic, readonly) NSString *title -
The coordinates of the waypoint. This is
kCLLocationCoordinate2DInvalidif this waypoint was initialized from a Place ID.Declaration
Swift
var coordinate: CLLocationCoordinate2D { get }Objective-C
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; -
The place ID associated with the waypoint.
For waypoints created via
-initWithPlaceID:title:, this is the place ID for the destination to which routing will be done.For waypoints created via
-initWithLocation:placeID:title:, this is the place ID of the place to be used for arrival context when routing to the given location.For other waypoints, this property will be nil.
Declaration
Swift
var placeID: String? { get }Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *placeID; -
The navigation point token of this waypoint. This is nil if this waypoint was initialized without a navigation point token.
Declaration
Swift
var navigationPointToken: String? { get }Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *navigationPointToken; -
Whether it is preferred to route the driver to the same side of the road. The route will arrive on the preferred side of the road unless there is a significant delay caused by a road closure or slow-moving traffic. Default to NO.
Declaration
Swift
var preferSameSideOfRoad: Bool { get }Objective-C
@property (nonatomic, readonly) BOOL preferSameSideOfRoad; -
An angle used to express the direction of traffic on the side of the road that the vehicle should arrive on. Consequently, it is not useful for one-way streets. Units expressed in degrees [0, 360], where 0 means North and angles increase clockwise. Default and unset value is -1.
Declaration
Swift
var preferredHeading: Int32 { get }Objective-C
@property (nonatomic, readonly) int32_t preferredHeading; -
Indicates that the waypoint is meant for vehicles to stop at, where the intention is to either pickup or drop-off. When you set this value, waypoints on roads that are unsuitable for pickup and drop-off may be adjusted to a more suitable location. This option works only for DRIVE and TWO_WHEELER travel modes. Default to NO. Note: In certain cases, particularly in metro areas, waypoints can not be set within tunnels even if vehicleStopover is set to NO.
Declaration
Swift
var vehicleStopover: Bool { get }Objective-C
@property (nonatomic, readonly) BOOL vehicleStopover; -
Initializes this
GMSNavigationWaypointto represent a location specified by 2D coordinates.Declaration
Swift
init?(location: CLLocationCoordinate2D, title: String)Objective-C
- (nullable instancetype)initWithLocation:(CLLocationCoordinate2D)location title:(nonnull NSString *)title;Parameters
locationThe location of this waypoint.
titleA string representing the name of the waypoint.
Return Value
An instance of
GMSNavigationWaypoint,or nil if the location is not valid. -
Initializes this
GMSNavigationWaypointto represent a location specified by a Place ID.Declaration
Swift
init?(placeID: String, title: String)Objective-C
- (nullable instancetype)initWithPlaceID:(nonnull NSString *)placeID title:(nonnull NSString *)title;Parameters
placeIDThe Google Place ID for this waypoint.
titleA string representing the name of the waypoint.
Return Value
An instance of
GMSNavigationWaypoint,or nil if the Place ID string is nil or empty. -
Initializes a waypoint which will route to the given location using the given placeID as context.
If you only have either a placeID or a location, use
initWithPlaceID:title:orinitWithLocation:title:Declaration
Swift
init?(location: CLLocationCoordinate2D, placeID: String, title: String)Objective-C
- (nullable instancetype)initWithLocation:(CLLocationCoordinate2D)location placeID:(nonnull NSString *)placeID title:(nonnull NSString *)title;Parameters
locationThe location of this waypoint.
placeIDThe ID of a place to be used to provide arrival context for the location.
titleA string representing the name of the waypoint.
Return Value
An instance of
GMSNavigationWaypoint, or nil ifplaceIDis nil/empty, or iflocationis invalid. -
Initializes this
GMSNavigationWaypointto represent a location specified by a navigation point token.Declaration
Swift
init?(navigationPointToken: String, title: String)Objective-C
- (nullable instancetype)initWithNavigationPointToken: (nonnull NSString *)navigationPointToken title:(nonnull NSString *)title;Parameters
navigationPointTokenAn opaque token returned by the Directions API that represents a precise waypoint location on the Google road network.
titleA string representing the name of the waypoint.
Return Value
An instance of
GMSNavigationWaypoint, or nil if the navigation point token is empty. -
Initializes
GMSNavigationWaypointto represent a location specified by 2D coordinates and side of road preferences.Declaration
Swift
convenience init?(location: CLLocationCoordinate2D, title: String, preferSameSideOfRoad: Bool)Objective-C
- (nullable instancetype)initWithLocation:(CLLocationCoordinate2D)location title:(nonnull NSString *)title preferSameSideOfRoad:(BOOL)preferSameSideOfRoad;Parameters
locationThe latitude and longitude of the waypoint.
titleA string representing the name of the waypoint.
preferSameSideOfRoadWhether it is preferred to route the driver to the same side of the road. The route will arrive on the preferred side of the road unless there is a significant delay caused by a road closure or slow-moving traffic.
Return Value
An instance of
GMSNavigationWaypoint,or nil if the location is not valid. -
Initializes
GMSNavigationWaypointto represent a location specified by 2D coordinates and side of road preferences.Declaration
Swift
convenience init?(location: CLLocationCoordinate2D, title: String, preferredSegmentHeading: Int32)Objective-C
- (nullable instancetype)initWithLocation:(CLLocationCoordinate2D)location title:(nonnull NSString *)title preferredSegmentHeading:(int32_t)preferredSegmentHeading;Parameters
locationThe latitude and longitude of the waypoint.
titleA string representing the name of the waypoint.
preferredSegmentHeadingAn angle used to express the direction of traffic on the side of the road that the vehicle should arrive on. Consequently, it is not useful for one-way streets. Units expressed in degrees [0, 360], where 0 means North.
Return Value
An instance of
GMSNavigationWaypoint,or nil if the location or the preferredSegmentHeading is not valid. -
Unavailable
Declaration
Objective-C
- (null_unspecified instancetype)init NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE; -
Declaration
Swift
func copy() -> GMSNavigationWaypointObjective-C
- (GMSNavigationWaypoint *)copy; -
Declaration
Swift
func mutableCopy() -> GMSNavigationMutableWaypointObjective-C
- (GMSNavigationMutableWaypoint *)mutableCopy;