AI-generated Key Takeaways
-
GMSFeatureStyle
defines the visual appearance of map features, such as fill color, border color, and border width. -
It can be used to style points, lines, and polygons on a Google Map.
-
Developers can create and customize styles using properties like
fillColor
,strokeColor
, andstrokeWidth
. -
For points, the
pointRadius
property controls the size. -
GMSFeatureStyle
is immutable, but a mutable copy (GMSMutableFeatureStyle
) can be created for modifications.
GMSFeatureStyle
@interface GMSFeatureStyle : NSObject <NSCopying, NSMutableCopying>
Specifies how a map feature should appear when displayed on a map.
-
Creates a new style.
Declaration
Objective-C
+ (nonnull instancetype)styleWithFillColor:(nullable UIColor *)fillColor strokeColor:(nullable UIColor *)strokeColor strokeWidth:(CGFloat)strokeWidth;
-
Initializes a new style.
Declaration
Swift
init(fill fillColor: UIColor?, stroke strokeColor: UIColor?, strokeWidth: CGFloat)
Objective-C
- (nonnull instancetype)initWithFillColor:(nullable UIColor *)fillColor strokeColor:(nullable UIColor *)strokeColor strokeWidth:(CGFloat)strokeWidth;
-
Initializes a default style.
Declaration
Swift
init()
Objective-C
- (nonnull instancetype)init;
-
Specifies the fill color, including the alpha channel.
Declaration
Swift
@NSCopying var fillColor: UIColor? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) UIColor *fillColor;
-
Specifies the border color, including the alpha channel.
Declaration
Swift
@NSCopying var strokeColor: UIColor? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) UIColor *strokeColor;
-
Specifies the border width, in screen points.
Declaration
Swift
var strokeWidth: CGFloat { get }
Objective-C
@property (nonatomic, readonly) CGFloat strokeWidth;
-
Specifies the radius of a point. Only applies to point geometries.
Declaration
Swift
var pointRadius: CGFloat { get }
Objective-C
@property (nonatomic, readonly) CGFloat pointRadius;
-
Declaration
Swift
func copy() -> FeatureStyle
Objective-C
- (GMSFeatureStyle *)copy;
-
Declaration
Swift
func mutableCopy() -> MutableFeatureStyle
Objective-C
- (GMSMutableFeatureStyle *)mutableCopy;