GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSStyleSpan
@interface GMSStyleSpan : NSObject
Describes the style for some region of a polyline.
-
Factory returning a solid color span of length one segment. Equivalent to
[GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:color] segments:1]
.
Declaration
Swift
convenience init(color: UIColor)
Objective-C
+ (nonnull instancetype)spanWithColor:(nonnull UIColor *)color;
-
Factory returning a solid color span with a given number of segments. Equivalent to
[GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:color] segments:segments]
.
Declaration
Swift
convenience init(color: UIColor, segments: Double)
Objective-C
+ (nonnull instancetype)spanWithColor:(nonnull UIColor *)color
segments:(double)segments;
-
Factory returning a span with the given style
of length one segment. Equivalent to
[GMSStyleSpan spanWithStyle:style segments:1]
.
Declaration
Objective-C
+ (nonnull instancetype)spanWithStyle:(nonnull GMSStrokeStyle *)style;
-
Factory returning a span with the given style
and length in number of segments. segments
must
be greater than 0 (i.e. can’t be 0).
Declaration
Objective-C
+ (nonnull instancetype)spanWithStyle:(nonnull GMSStrokeStyle *)style
segments:(double)segments;
-
Declaration
Objective-C
@property (nonatomic, readonly) GMSStrokeStyle *_Nonnull style;
-
The length of this span in number of segments.
Declaration
Swift
var segments: Double { get }
Objective-C
@property (nonatomic, readonly) double segments;
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\u003eGMSStyleSpan\u003c/code\u003e defines the style for a portion of a polyline, like color or pattern.\u003c/p\u003e\n"],["\u003cp\u003eIt can be initialized with a solid color or a \u003ccode\u003eGMSStrokeStyle\u003c/code\u003e for more complex styling.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esegments\u003c/code\u003e property indicates the length of the span along the polyline, measured in segments.\u003c/p\u003e\n"],["\u003cp\u003eFactory methods like \u003ccode\u003espanWithColor:\u003c/code\u003e and \u003ccode\u003espanWithStyle:\u003c/code\u003e provide convenient ways to create \u003ccode\u003eGMSStyleSpan\u003c/code\u003e instances.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003estyle\u003c/code\u003e property provides access to the \u003ccode\u003eGMSStrokeStyle\u003c/code\u003e associated with the span, allowing for detailed customization.\u003c/p\u003e\n"]]],[],null,["# GoogleNavigation Framework Reference\n\nGMSStyleSpan\n============\n\n @interface GMSStyleSpan : NSObject\n\nDescribes the style for some region of a polyline.\n- `\n ``\n ``\n `\n\n ### [+spanWithColor:](#/c:objc(cs)GMSStyleSpan(cm)spanWithColor:)\n\n `\n ` \n Factory returning a solid color span of length one segment. Equivalent to\n `[GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:color] segments:1]`. \n\n #### Declaration\n\n Swift \n\n convenience init(color: UIColor)\n\n Objective-C \n\n + (nonnull instancetype)spanWithColor:(nonnull UIColor *)color;\n\n- `\n ``\n ``\n `\n\n ### [+spanWithColor:segments:](#/c:objc(cs)GMSStyleSpan(cm)spanWithColor:segments:)\n\n `\n ` \n Factory returning a solid color span with a given number of segments. Equivalent to\n `[GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:color] segments:segments]`. \n\n #### Declaration\n\n Swift \n\n convenience init(color: UIColor, segments: Double)\n\n Objective-C \n\n + (nonnull instancetype)spanWithColor:(nonnull UIColor *)color\n segments:(double)segments;\n\n- `\n ``\n ``\n `\n\n ### [+spanWithStyle:](#/c:objc(cs)GMSStyleSpan(cm)spanWithStyle:)\n\n `\n ` \n Factory returning a span with the given [style](../Classes/GMSStyleSpan.html#/c:objc(cs)GMSStyleSpan(py)style) of length one segment. Equivalent to\n `[GMSStyleSpan spanWithStyle:style segments:1]`. \n\n #### Declaration\n\n Swift \n\n convenience init(style: ../Classes/GMSStrokeStyle.html)\n\n Objective-C \n\n + (nonnull instancetype)spanWithStyle:(nonnull ../Classes/GMSStrokeStyle.html *)style;\n\n- `\n ``\n ``\n `\n\n ### [+spanWithStyle:segments:](#/c:objc(cs)GMSStyleSpan(cm)spanWithStyle:segments:)\n\n `\n ` \n Factory returning a span with the given [style](../Classes/GMSStyleSpan.html#/c:objc(cs)GMSStyleSpan(py)style) and length in number of segments. [segments](../Classes/GMSStyleSpan.html#/c:objc(cs)GMSStyleSpan(py)segments) must\n be greater than 0 (i.e. can't be 0). \n\n #### Declaration\n\n Swift \n\n convenience init(style: ../Classes/GMSStrokeStyle.html, segments: Double)\n\n Objective-C \n\n + (nonnull instancetype)spanWithStyle:(nonnull ../Classes/GMSStrokeStyle.html *)style\n segments:(double)segments;\n\n- `\n ``\n ``\n `\n\n ### [style](#/c:objc(cs)GMSStyleSpan(py)style)\n\n `\n ` \n The style of this span. \n\n #### Declaration\n\n Swift \n\n var style: ../Classes/GMSStrokeStyle.html { get }\n\n Objective-C \n\n @property (nonatomic, readonly) ../Classes/GMSStrokeStyle.html *_Nonnull style;\n\n- `\n ``\n ``\n `\n\n ### [segments](#/c:objc(cs)GMSStyleSpan(py)segments)\n\n `\n ` \n The length of this span in number of segments. \n\n #### Declaration\n\n Swift \n\n var segments: Double { get }\n\n Objective-C \n\n @property (nonatomic, readonly) double segments;"]]