GoogleMaps Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSCollisionBehavior
enum GMSCollisionBehavior : NSInteger {}
How markers interact with other markers and regular labels. Defaults to
GMSCollisionBehaviorRequired
.
Marker collisions occur when coordinates intersect.
Priority is defined as:
1) Required > Optional
2) zIndex: higher zIndex > lower zIndex
Beyond this, it is undefined which marker will show if both are optional and have the same
zIndex.
Regular map labels are the lowest priority.
-
Always display the marker regardless of collision. This is the default behavior.
Has no impact on whether any other markers or basemap labels show.
Declaration
Objective-C
GMSCollisionBehaviorRequired
-
Always display the marker regardless of collision, and hide any
CollisionBehaviorOptionalAndHidesLowerPriority markers or labels that would overlap with the
marker.
Declaration
Swift
case requiredAndHidesOptional = 1
Objective-C
GMSCollisionBehaviorRequiredAndHidesOptional
-
Display the marker only if it does not overlap with other markers. Does not include
GMSCollisionBehaviorRequired
. If two markers of this type would overlap, the one with the
higher zIndex is shown. Collision rules for markers with the same zIndex is undefined.
Declaration
Swift
case optionalAndHidesLowerPriority = 2
Objective-C
GMSCollisionBehaviorOptionalAndHidesLowerPriority
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\u003eGMSCollisionBehavior\u003c/code\u003e controls how markers interact with each other and map labels, prioritizing required markers over optional ones and higher \u003ccode\u003ezIndex\u003c/code\u003e values.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSCollisionBehaviorRequired\u003c/code\u003e ensures a marker always displays, regardless of potential overlaps.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSCollisionBehaviorRequiredAndHidesOptional\u003c/code\u003e prioritizes the marker, hiding any optional markers or labels it overlaps.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSCollisionBehaviorOptionalAndHidesLowerPriority\u003c/code\u003e displays the marker only if it doesn't overlap with required markers or those with a higher \u003ccode\u003ezIndex\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# GoogleMaps Framework Reference\n\nGMSCollisionBehavior\n====================\n\n enum GMSCollisionBehavior : NSInteger {}\n\nHow markers interact with other markers and regular labels. Defaults to\n`GMSCollisionBehaviorRequired`.\n\nMarker collisions occur when coordinates intersect.\n\nPriority is defined as:\n1) Required \\\u003e Optional\n2) zIndex: higher zIndex \\\u003e lower zIndex\n\nBeyond this, it is undefined which marker will show if both are optional and have the same\nzIndex.\nRegular map labels are the lowest priority.\n- `\n ``\n ``\n `\n\n ### [GMSCollisionBehaviorRequired](#/c:@E@GMSCollisionBehavior@GMSCollisionBehaviorRequired)\n\n `\n ` \n Always display the marker regardless of collision. This is the default behavior.\n Has no impact on whether any other markers or basemap labels show. \n\n #### Declaration\n\n Swift \n\n case required = 0\n\n Objective-C \n\n GMSCollisionBehaviorRequired\n\n- `\n ``\n ``\n `\n\n ### [GMSCollisionBehaviorRequiredAndHidesOptional](#/c:@E@GMSCollisionBehavior@GMSCollisionBehaviorRequiredAndHidesOptional)\n\n `\n ` \n Always display the marker regardless of collision, and hide any\n CollisionBehaviorOptionalAndHidesLowerPriority markers or labels that would overlap with the\n marker. \n\n #### Declaration\n\n Swift \n\n case requiredAndHidesOptional = 1\n\n Objective-C \n\n GMSCollisionBehaviorRequiredAndHidesOptional\n\n- `\n ``\n ``\n `\n\n ### [GMSCollisionBehaviorOptionalAndHidesLowerPriority](#/c:@E@GMSCollisionBehavior@GMSCollisionBehaviorOptionalAndHidesLowerPriority)\n\n `\n ` \n Display the marker only if it does not overlap with other markers. Does not include\n [GMSCollisionBehaviorRequired](../Enums/GMSCollisionBehavior.html#/c:@E@GMSCollisionBehavior@GMSCollisionBehaviorRequired). If two markers of this type would overlap, the one with the\n higher zIndex is shown. Collision rules for markers with the same zIndex is undefined. \n\n #### Declaration\n\n Swift \n\n case optionalAndHidesLowerPriority = 2\n\n Objective-C \n\n GMSCollisionBehaviorOptionalAndHidesLowerPriority"]]