AI-generated Key Takeaways
-
GMSCirclerepresents a circle on the Earth's surface, defined by its center position and radius. -
It can be customized with properties such as stroke width, stroke color, and fill color.
-
Stroke width is in screen points and does not scale with map zoom, while a stroke width of 0 results in no stroke.
-
The default stroke color is black, and the default fill color is nil (transparent), resulting in no fill.
-
A convenience constructor
circleWithPosition:radius:allows for easy creation ofGMSCircleobjects.
GMSCircle
@interface GMSCircle : GMSOverlayA circle on the Earth’s surface (spherical cap).
-
Position on Earth of circle center. Ignores invalid positions.
Declaration
Swift
var position: CLLocationCoordinate2D { get set }Objective-C
@property (nonatomic) CLLocationCoordinate2D position; -
Radius of the circle in meters; must be positive.
Declaration
Swift
var radius: CLLocationDistance { get set }Objective-C
@property (nonatomic) CLLocationDistance radius; -
The width of the circle’s outline in screen points. Defaults to 1. As per
GMSPolygon, the width does not scale when the map is zoomed.Setting strokeWidth to 0 results in no stroke.
Declaration
Swift
var strokeWidth: CGFloat { get set }Objective-C
@property (nonatomic) CGFloat strokeWidth; -
The color of this circle’s outline. The default value is black.
Declaration
Swift
var strokeColor: UIColor? { get set }Objective-C
@property (nonatomic, nullable) UIColor *strokeColor; -
The interior of the circle is painted with fillColor. The default value is nil, resulting in no fill.
Declaration
Swift
var fillColor: UIColor? { get set }Objective-C
@property (nonatomic, nullable) UIColor *fillColor; -
Convenience constructor for
GMSCirclefor a particular position and radius. Other properties will have default values. An invalid position will result in an overlay object that cannot be drawn on the map.Declaration
Swift
convenience init(position: CLLocationCoordinate2D, radius: CLLocationDistance)Objective-C
+ (nonnull instancetype)circleWithPosition:(CLLocationCoordinate2D)position radius:(CLLocationDistance)radius;