GoogleMaps Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSOverlay
@interface GMSOverlay : NSObject <NSCopying>
GMSOverlay is an abstract class that represents some overlay that may be attached to a specific
GMSMapView. It may not be instantiated directly; instead, instances of concrete overlay types
should be created directly (such as GMSMarker
, GMSPolyline
, and GMSPolygon
).
This supports the NSCopying
protocol; [overlay_ copy] will return a copy of the overlay type,
but with map
set to nil.
-
Title, a short description of the overlay. Some overlays, such as markers, will display the title
on the map. The title is also the default accessibility text.
Declaration
Swift
var title: String? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSString *title;
-
The map this overlay is on. Setting this property will add the overlay to the map. Setting it to
nil removes this overlay from the map. An overlay may be active on at most one map at any given
time.
Declaration
Objective-C
@property (nonatomic, weak, nullable) GMSMapView *map;
-
If this overlay should cause tap notifications. Some overlays, such as markers, will default to
being tappable.
Declaration
Swift
var isTappable: Bool { get set }
Objective-C
@property (nonatomic, getter=isTappable) BOOL tappable;
-
Higher zIndex
value overlays will be drawn on top of lower zIndex
value tile layers and
overlays. Equal values result in undefined draw ordering. Markers are an exception that
regardless of zIndex
, they will always be drawn above tile layers and other non-marker
overlays; they are effectively considered to be in a separate z-index group compared to other
overlays.
Declaration
Swift
var zIndex: Int32 { get set }
Objective-C
@property (nonatomic) int zIndex;
-
Overlay data. You can use this property to associate an arbitrary object with this overlay.
Google Maps SDK for iOS neither reads nor writes this property.
Note that userData should not hold any strong references to any Maps objects, otherwise a retain
cycle may be created (preventing objects from being released).
Declaration
Swift
var userData: Any? { get set }
Objective-C
@property (nonatomic, nullable) id userData;
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\u003eGMSOverlay\u003c/code\u003e is an abstract class representing an overlay on a \u003ccode\u003eGMSMapView\u003c/code\u003e, and concrete types like \u003ccode\u003eGMSMarker\u003c/code\u003e, \u003ccode\u003eGMSPolyline\u003c/code\u003e, and \u003ccode\u003eGMSPolygon\u003c/code\u003e should be used instead of direct instantiation.\u003c/p\u003e\n"],["\u003cp\u003eIt has properties like \u003ccode\u003etitle\u003c/code\u003e for a short description, \u003ccode\u003emap\u003c/code\u003e to link with the map view, and \u003ccode\u003etappable\u003c/code\u003e to enable tap notifications.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ezIndex\u003c/code\u003e controls the drawing order of overlays, with markers always drawn above non-marker overlays regardless of \u003ccode\u003ezIndex\u003c/code\u003e value.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003euserData\u003c/code\u003e property allows attaching arbitrary data to the overlay, but avoid strong references to Maps objects to prevent retain cycles.\u003c/p\u003e\n"]]],["`GMSOverlay` is an abstract class for map overlays like `GMSMarker`, `GMSPolyline`, and `GMSPolygon`. Overlays can have a `title`, be added to a `map`, or removed if the map is set to nil. The `tappable` property determines if an overlay triggers tap events. The `zIndex` property controls the drawing order, with higher values drawn on top. `userData` allows associating an object with the overlay, avoiding strong references to Maps objects. Overlays can be copied, resulting in a new overlay with a nil map.\n"],null,["# GoogleMaps Framework Reference\n\nGMSOverlay\n==========\n\n @interface GMSOverlay : NSObject \u003cNSCopying\u003e\n\n`GMSOverlay is an abstract class that represents some overlay that may be attached to a specific`\n`GMSMapView. It may not be instantiated directly; instead, instances of concrete overlay types`\nshould be created directly (such as [GMSMarker](../Classes/GMSMarker.html), [GMSPolyline](../Classes/GMSPolyline.html), and [GMSPolygon](../Classes/GMSPolygon.html)).\n\nThis supports the `NSCopying` protocol; \\[overlay_ copy\\] will return a copy of the overlay type,\nbut with `map` set to nil.\n- `\n ``\n ``\n `\n\n ### [title](#/c:objc(cs)GMSOverlay(py)title)\n\n `\n ` \n Title, a short description of the overlay. Some overlays, such as markers, will display the title\n on the map. The title is also the default accessibility text. \n\n #### Declaration\n\n Swift \n\n var title: String? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSString *title;\n\n- `\n ``\n ``\n `\n\n ### [map](#/c:objc(cs)GMSOverlay(py)map)\n\n `\n ` \n The map this overlay is on. Setting this property will add the overlay to the map. Setting it to\n nil removes this overlay from the map. An overlay may be active on at most one map at any given\n time. \n\n #### Declaration\n\n Swift \n\n weak var map: ../Classes/GMSMapView.html? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) ../Classes/GMSMapView.html *map;\n\n- `\n ``\n ``\n `\n\n ### [tappable](#/c:objc(cs)GMSOverlay(py)tappable)\n\n `\n ` \n If this overlay should cause tap notifications. Some overlays, such as markers, will default to\n being tappable. \n\n #### Declaration\n\n Swift \n\n var isTappable: Bool { get set }\n\n Objective-C \n\n @property (nonatomic, getter=isTappable) BOOL tappable;\n\n- `\n ``\n ``\n `\n\n ### [zIndex](#/c:objc(cs)GMSOverlay(py)zIndex)\n\n `\n ` \n Higher `zIndex` value overlays will be drawn on top of lower `zIndex` value tile layers and\n overlays. Equal values result in undefined draw ordering. Markers are an exception that\n regardless of `zIndex`, they will always be drawn above tile layers and other non-marker\n overlays; they are effectively considered to be in a separate z-index group compared to other\n overlays. \n\n #### Declaration\n\n Swift \n\n var zIndex: Int32 { get set }\n\n Objective-C \n\n @property (nonatomic) int zIndex;\n\n- `\n ``\n ``\n `\n\n ### [userData](#/c:objc(cs)GMSOverlay(py)userData)\n\n `\n ` \n Overlay data. You can use this property to associate an arbitrary object with this overlay.\n Google Maps SDK for iOS neither reads nor writes this property.\n\n Note that userData should not hold any strong references to any Maps objects, otherwise a retain\n cycle may be created (preventing objects from being released). \n\n #### Declaration\n\n Swift \n\n var userData: Any? { get set }\n\n Objective-C \n\n @property (nonatomic, nullable) id userData;"]]