MTLineLayer
public class MTLineLayer : MTLayer, @unchecked Sendable, Codable
The line style layer that renders one or more stroked polylines on the map.
-
Unique layer identifier.
Declaration
Swift
public var identifier: String
-
Type of the layer.
Declaration
Swift
public private(set) var type: MTLayerType { get }
-
Identifier of the source to be used for this layer.
Declaration
Swift
public var sourceIdentifier: String
-
The maximum zoom level for the layer.
Optional number between 0 and 24. At zoom levels equal to or greater than the maxzoom, the layer will be hidden.
Declaration
Swift
public var maxZoom: Double?
-
The minimum zoom level for the layer.
Optional number between 0 and 24. At zoom levels less than the minzoom, the layer will be hidden.
Declaration
Swift
public var minZoom: Double?
-
Layer to use from a vector tile source.
Required for vector tile sources; prohibited for all other source types, including GeoJSON sources.
Declaration
Swift
public var sourceLayer: String?
-
Blur of the line.
Declaration
Swift
public var blur: Double?
-
The display of line endings.
Declaration
Swift
public var cap: MTLineCap?
-
The color with which the line will be drawn.
Declaration
Swift
public var color: UIColor?
-
The lengths of the alternating dashes and gaps that form the dash pattern.
Declaration
Swift
public var dashArray: [Double]?
-
Line casing outside of a line’s actual path.
Declaration
Swift
public var gapWidth: Double?
-
The gradient with which to color a line feature.
Can only be used with GeoJSON sources that specify “lineMetrics”: true.
Declaration
Swift
public var gradient: UIColor?
-
The display of lines when joining.
Declaration
Swift
public var join: MTLineJoin?
-
Used to automatically convert miter joins to bevel joins for sharp angles.
Requires join to be “miter”.
Declaration
Swift
public var miterLimit: Double?
-
The line’s offset.
For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.
Declaration
Swift
public var offset: Double?
-
Optional number between 0 and 1 inclusive.
Declaration
Swift
public var opacity: Double?
-
Used to automatically convert round joins to miter joins for shallow angles.
Declaration
Swift
public var roundLimit: Double?
-
Feature ordering value.
Features with a higher sort key will appear above features with a lower sort key.
Declaration
Swift
public var sortKey: Double?
-
The geometry’s offset.
Values are [x, y] where negatives indicate left and up, respectively.
Declaration
Swift
public var translate: [Double]?
-
Controls the frame of reference for translate.
Declaration
Swift
public var translateAnchor: MTLineTranslateAnchor?
-
Width of the line.
Declaration
Swift
public var width: Double?
-
Enum controlling whether this layer is displayed.
Declaration
Swift
public var visibility: MTLayerVisibility?
-
Initializes the layer with unique identifier, source identifier, max and min zoom levels and source layer, which is required for vector tile sources.
Declaration
Swift
public init( identifier: String, sourceIdentifier: String, maxZoom: Double, minZoom: Double, sourceLayer: String? = nil )
-
init(identifier:
sourceIdentifier: maxZoom: minZoom: sourceLayer: blur: cap: color: dashArray: gapWidth: gradient: join: miterLimit: offset: opacity: roundLimit: sortKey: translate: translateAnchor: width: visibility: ) Initializes the layer with all options.
Declaration
Swift
public init( identifier: String, sourceIdentifier: String, maxZoom: Double? = nil, minZoom: Double? = nil, sourceLayer: String? = nil, blur: Double? = 0.0, cap: MTLineCap? = .butt, color: UIColor? = .black, dashArray: [Double]? = nil, gapWidth: Double? = 0.0, gradient: UIColor? = nil, join: MTLineJoin? = .miter, miterLimit: Double? = 2.0, offset: Double? = 0.0, opacity: Double? = 1.0, roundLimit: Double? = 1.05, sortKey: Double? = nil, translate: [Double]? = [0.0, 0.0], translateAnchor: MTLineTranslateAnchor? = .map, width: Double? = 1.0, visibility: MTLayerVisibility? = .visible )
-
Initializes layer from the decoder.
Declaration
Swift
public required init(from decoder: any Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Adds layer to map DSL style.
Prefer
addLayer(_:)
on MTMapView instead.Declaration
Swift
public func addToMap(_ mapView: MTMapView)
-
Modifier. Sets the
maxZoom
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func maxZoom(_ value: Double) -> Self
-
Modifier. Sets the
minZoom
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func minZoom(_ value: Double) -> Self
-
Modifier. Sets the
sourceLayer
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func sourceLayer(_ value: String) -> Self
-
Modifier. Sets the
blur
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func blur(_ value: Double) -> Self
-
Modifier. Sets the
color
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func color(_ value: UIColor) -> Self
-
Modifier. Sets the
dashArray
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func dashArray(_ value: [Double]) -> Self
-
Modifier. Sets the
gapWidth
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func gapWidth(_ value: Double) -> Self
-
Modifier. Sets the
gradient
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func gradient(_ value: UIColor) -> Self
-
Modifier. Sets the
join
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func join(_ value: MTLineJoin) -> Self
-
Modifier. Sets the
miterLimit
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func miterLimit(_ value: Double) -> Self
-
Modifier. Sets the
offset
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func offset(_ value: Double) -> Self
-
Modifier. Sets the
opacity
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func opacity(_ value: Double) -> Self
-
Modifier. Sets the
roundLimit
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func roundLimit(_ value: Double) -> Self
-
Modifier. Sets the
sortKey
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func sortKey(_ value: Double) -> Self
-
Modifier. Sets the
translate
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func translate(_ value: [Double]) -> Self
-
Modifier. Sets the
translateAnchor
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func translateAnchor(_ value: MTLineTranslateAnchor) -> Self
-
Modifier. Sets the
width
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func width(_ value: Double) -> Self
-
Modifier. Sets the
visibility
.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func visibility(_ value: MTLayerVisibility) -> Self