GoogleRidesharingConsumer Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMTCMapView
@interface GMTCMapView : GMSMapView
This class represents the main view in the Consumer SDK for iOS.
You can use this class to create a customizable map so that your users can
use the consumerMapStylecoordinator
to create custom markers and polylines.
Note: You should instantiate this map via the default constructor [[GMTCMapView alloc]
initWithFrame:]
.
GMTCMapView
can be read and modified only from the main thread, similar to GMSMapView
and all
UIKit objects. Calling these methods from another thread results in an exception or undefined
behavior.
-
Delegate of the map view.
-
Maintains customizable UI options for the library’s markers, polylines, and polygons.
-
Allows the map view’s camera to auto-update. The default value is YES.
Declaration
Swift
var isAllowCameraAutoUpdate: Bool { get set }
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite,
getter=isAllowCameraAutoUpdate) BOOL allowCameraAutoUpdate;
-
Creates a new map view with the given options. The value of the options object is copied by this
method.
Declaration
Swift
init(options: GMSMapViewOptions)
Objective-C
- (nonnull instancetype)initWithOptions:(nonnull GMSMapViewOptions *)options;
-
Deprecated
Use -initWithOptions
instead.
Initialization of the GMTCMapView
object.
Declaration
Swift
init(frame: CGRect)
Objective-C
- (nonnull instancetype)initWithFrame:(CGRect)frame;
-
Deprecated
Use -initWithOptions
instead.
Initialization with coder.
Declaration
Swift
init?(coder aDecoder: NSCoder)
Objective-C
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;
-
Resets the mapView’s camera to the default position based on the current active mapView
session(s).
Declaration
Objective-C
- (void)resetCamera;
-
Forces a redraw of all the overlays for ridesharing that were rendered in the current map view.
These overlays include the ridesharing related markers referenced by GMTCCustomizableMarkerType
, the polygons for pickup compounded area and trip routes. You can use this method to redraw
overlays cleaned by calling clear
on GMTCMapView
. Note: This API does not restore the
overlays added from an application layer.
Declaration
Swift
func redrawRidesharingOverlays()
Objective-C
- (void)redrawRidesharingOverlays;
-
Shows a mapView session on the mapView.
-
Hides a mapView session on the mapView.
-
Hide all the mapView sessions on the mapView.
Declaration
Swift
func hideAllMapViewSessions()
Objective-C
- (void)hideAllMapViewSessions;
-
Returns all the mapView sessions currently shown on the mapView.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMTCMapView\u003c/code\u003e is the primary view class in the Consumer SDK for iOS, allowing for the creation of customizable maps.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econsumerMapStyleCoordinator\u003c/code\u003e property enables custom styling of markers, polylines, and polygons.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMTCMapView\u003c/code\u003e can only be accessed and modified from the main thread, ensuring consistency with \u003ccode\u003eGMSMapView\u003c/code\u003e and UIKit.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eallowCameraAutoUpdate\u003c/code\u003e property lets you control whether the map's camera can automatically update, defaulting to enabled.\u003c/p\u003e\n"],["\u003cp\u003eUse \u003ccode\u003e-initWithOptions:\u003c/code\u003e for creating new \u003ccode\u003eGMTCMapView\u003c/code\u003e instances, as \u003ccode\u003e-initWithFrame:\u003c/code\u003e and \u003ccode\u003e-initWithCoder:\u003c/code\u003e are deprecated.\u003c/p\u003e\n"]]],[],null,["# GoogleRidesharingConsumer Framework Reference\n\nGMTCMapView\n===========\n\n @interface GMTCMapView : GMSMapView\n\nThis class represents the main view in the Consumer SDK for iOS.\nYou can use this class to create a customizable map so that your users can\nuse the `consumerMapStylecoordinator` to create custom markers and polylines.\n\nNote: You should instantiate this map via the default constructor `[[GMTCMapView alloc]\ninitWithFrame:]`.\n\n`GMTCMapView` can be read and modified only from the main thread, similar to `GMSMapView` and all\nUIKit objects. Calling these methods from another thread results in an exception or undefined\nbehavior.\n- `\n ``\n ``\n `\n\n ### [delegate](#/c:objc(cs)GMTCMapView(py)delegate)\n\n `\n ` \n Delegate of the map view. \n\n #### Declaration\n\n Swift \n\n weak var delegate: (any ../Protocols/GMTCMapViewDelegate.html)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/GMTCMapViewDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n ### [consumerMapStyleCoordinator](#/c:objc(cs)GMTCMapView(py)consumerMapStyleCoordinator)\n\n `\n ` \n Maintains customizable UI options for the library's markers, polylines, and polygons. \n\n #### Declaration\n\n Swift \n\n var consumerMapStyleCoordinator: ../Classes/GMTCConsumerMapStyleCoordinator.html { get }\n\n Objective-C \n\n @property (nonatomic, readonly) ../Classes/GMTCConsumerMapStyleCoordinator.html *_Nonnull consumerMapStyleCoordinator;\n\n- `\n ``\n ``\n `\n\n ### [allowCameraAutoUpdate](#/c:objc(cs)GMTCMapView(py)allowCameraAutoUpdate)\n\n `\n ` \n Allows the map view's camera to auto-update. The default value is YES. \n\n #### Declaration\n\n Swift \n\n var isAllowCameraAutoUpdate: Bool { get set }\n\n Objective-C \n\n @property (nonatomic, assign, unsafe_unretained, readwrite,\n getter=isAllowCameraAutoUpdate) BOOL allowCameraAutoUpdate;\n\n- `\n ``\n ``\n `\n\n ### [-initWithOptions:](#/c:objc(cs)GMTCMapView(im)initWithOptions:)\n\n `\n ` \n Creates a new map view with the given options. The value of the options object is copied by this\n method. \n\n #### Declaration\n\n Swift \n\n init(options: GMSMapViewOptions)\n\n Objective-C \n\n - (nonnull instancetype)initWithOptions:(nonnull GMSMapViewOptions *)options;\n\n- `\n ``\n ``\n `\n\n ### [-initWithFrame:](#/c:objc(cs)GMTCMapView(im)initWithFrame:)\n\n `\n ` \n Deprecated\n\n Use `-initWithOptions` instead. \n Initialization of the `GMTCMapView` object. \n\n #### Declaration\n\n Swift \n\n init(frame: CGRect)\n\n Objective-C \n\n - (nonnull instancetype)initWithFrame:(CGRect)frame;\n\n- `\n ``\n ``\n `\n\n ### [-initWithCoder:](#/c:objc(cs)GMTCMapView(im)initWithCoder:)\n\n `\n ` \n Deprecated\n\n Use `-initWithOptions` instead. \n Initialization with coder. \n\n #### Declaration\n\n Swift \n\n init?(coder aDecoder: NSCoder)\n\n Objective-C \n\n - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;\n\n- `\n ``\n ``\n `\n\n ### [-resetCamera](#/c:objc(cs)GMTCMapView(im)resetCamera)\n\n `\n ` \n Resets the mapView's camera to the default position based on the current active mapView\n session(s). \n\n #### Declaration\n\n Swift \n\n func resetCamera()\n\n Objective-C \n\n - (void)resetCamera;\n\n- `\n ``\n ``\n `\n\n ### [-redrawRidesharingOverlays](#/c:objc(cs)GMTCMapView(im)redrawRidesharingOverlays)\n\n `\n ` \n Forces a redraw of all the overlays for ridesharing that were rendered in the current map view.\n These overlays include the ridesharing related markers referenced by [GMTCCustomizableMarkerType](../Enums/GMTCCustomizableMarkerType.html)\n , the polygons for pickup compounded area and trip routes. You can use this method to redraw\n overlays cleaned by calling `clear` on `GMTCMapView`. Note: This API does not restore the\n overlays added from an application layer. \n\n #### Declaration\n\n Swift \n\n func redrawRidesharingOverlays()\n\n Objective-C \n\n - (void)redrawRidesharingOverlays;\n\n- `\n ``\n ``\n `\n\n ### [-showMapViewSession:](#/c:objc(cs)GMTCMapView(im)showMapViewSession:)\n\n `\n ` \n Shows a mapView session on the mapView. \n\n #### Declaration\n\n Swift \n\n func show(_ session: any ../Protocols/GMTCMapViewSession.html)\n\n Objective-C \n\n - (void)showMapViewSession:(nonnull id\u003c../Protocols/GMTCMapViewSession.html\u003e)session;\n\n- `\n ``\n ``\n `\n\n ### [-hideMapViewSession:](#/c:objc(cs)GMTCMapView(im)hideMapViewSession:)\n\n `\n ` \n Hides a mapView session on the mapView. \n\n #### Declaration\n\n Swift \n\n func hide(_ session: any ../Protocols/GMTCMapViewSession.html)\n\n Objective-C \n\n - (void)hideMapViewSession:(nonnull id\u003c../Protocols/GMTCMapViewSession.html\u003e)session;\n\n- `\n ``\n ``\n `\n\n ### [-hideAllMapViewSessions](#/c:objc(cs)GMTCMapView(im)hideAllMapViewSessions)\n\n `\n ` \n Hide all the mapView sessions on the mapView. \n\n #### Declaration\n\n Swift \n\n func hideAllMapViewSessions()\n\n Objective-C \n\n - (void)hideAllMapViewSessions;\n\n- `\n ``\n ``\n `\n\n ### [-activeSessions](#/c:objc(cs)GMTCMapView(im)activeSessions)\n\n `\n ` \n Returns all the mapView sessions currently shown on the mapView. \n\n #### Declaration\n\n Swift \n\n func activeSessions() -\u003e [any ../Protocols/GMTCMapViewSession.html]\n\n Objective-C \n\n - (nonnull NSArray\u003cid\u003c../Protocols/GMTCMapViewSession.html\u003e\u003e *)activeSessions;"]]