AI-generated Key Takeaways
-
GMTCMapViewis the primary view class in the Consumer SDK for iOS, allowing for the creation of customizable maps. -
The
consumerMapStyleCoordinatorproperty enables custom styling of markers, polylines, and polygons. -
GMTCMapViewcan only be accessed and modified from the main thread, ensuring consistency withGMSMapViewand UIKit. -
The
allowCameraAutoUpdateproperty lets you control whether the map's camera can automatically update, defaulting to enabled. -
Use
-initWithOptions:for creating newGMTCMapViewinstances, as-initWithFrame:and-initWithCoder:are deprecated.
GMTCMapView
@interface GMTCMapView : GMSMapViewThis 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.
Declaration
Swift
weak var delegate: (any GMTCMapViewDelegate)? { get set }Objective-C
@property (nonatomic, weak, nullable) id<GMTCMapViewDelegate> delegate; -
Maintains customizable UI options for the library’s markers, polylines, and polygons.
Declaration
Swift
var consumerMapStyleCoordinator: GMTCConsumerMapStyleCoordinator { get }Objective-C
@property (nonatomic, readonly) GMTCConsumerMapStyleCoordinator *_Nonnull consumerMapStyleCoordinator; -
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
-initWithOptionsinstead.Initialization of the
GMTCMapViewobject.Declaration
Swift
init(frame: CGRect)Objective-C
- (nonnull instancetype)initWithFrame:(CGRect)frame; -
Deprecated
Use
-initWithOptionsinstead.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
Swift
func resetCamera()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 callingclearonGMTCMapView. 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.
Declaration
Swift
func show(_ session: any GMTCMapViewSession)Objective-C
- (void)showMapViewSession:(nonnull id<GMTCMapViewSession>)session; -
Hides a mapView session on the mapView.
Declaration
Swift
func hide(_ session: any GMTCMapViewSession)Objective-C
- (void)hideMapViewSession:(nonnull id<GMTCMapViewSession>)session; -
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.
Declaration
Swift
func activeSessions() -> [any GMTCMapViewSession]Objective-C
- (nonnull NSArray<id<GMTCMapViewSession>> *)activeSessions;