MTSymbolLayer
public class MTSymbolLayer : MTLayer, @unchecked Sendable, Codable
extension MTSymbolLayer: Equatable
The symbol style that layer renders icon and text labels at points or along lines on a 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? -
Icon to use for the layer.
Declaration
Swift
public var icon: UIImage? -
Enum controlling whether this layer is displayed.
Declaration
Swift
public var visibility: MTLayerVisibility? -
Optional initial filter to apply after the layer is added to the map.
Declaration
Swift
public var initialFilter: MTPropertyValue?
-
Text field (tokens allowed), e.g. “{point_count_abbreviated}”
Declaration
Swift
public var textField: String? -
Text size in px
Declaration
Swift
public var textSize: Double? -
Text allow overlap
Declaration
Swift
public var textAllowOverlap: Bool? -
Text anchor
Declaration
Swift
public var textAnchor: MTTextAnchor? -
Text font stack
Declaration
Swift
public var textFont: [String]? -
Inline filter expression for this layer
Declaration
Swift
public var filterExpression: MTPropertyValue?
-
Text color
Declaration
Swift
public var textColor: UIColor? -
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 ) -
Initializes the layer with the unique identifier and a source identifier.
Declaration
Swift
public init( identifier: String, sourceIdentifier: String ) -
Undocumented
Declaration
Swift
public init( identifier: String, sourceIdentifier: String, maxZoom: Double? = nil, minZoom: Double? = nil, sourceLayer: String? = nil, icon: UIImage? = nil, visibility: MTLayerVisibility? = .visible ) -
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
icon.Note
Not to be used outside of DSL.Declaration
Swift
public func icon(_ value: UIImage) -> Self -
Sets the symbol text field (tokens allowed).
Declaration
Swift
@discardableResult public func textField(_ value: String) -> SelfParameters
valueText field string, e.g. “{point_count_abbreviated}”.
-
Sets the symbol text size.
Declaration
Swift
@discardableResult public func textSize(_ value: Double) -> SelfParameters
valueText size in points.
-
Sets whether text labels can overlap.
Declaration
Swift
@discardableResult public func textAllowOverlap(_ value: Bool) -> SelfParameters
valueTrue to allow overlap.
-
Sets the text anchor position.
Declaration
Swift
@discardableResult public func textAnchor(_ value: MTTextAnchor) -> SelfParameters
valueAnchor for text placement.
-
Sets the preferred text fonts.
Declaration
Swift
@discardableResult public func textFont(_ value: [String]) -> SelfParameters
valueOrdered list of font family names.
-
Sets a constant text color for the symbol.
Declaration
Swift
@discardableResult public func paintTextColor(_ value: UIColor) -> SelfParameters
valueUIColor value.
-
Modifier. Sets the
visibility.Note
Not to be used outside of DSL.Declaration
Swift
@discardableResult public func visibility(_ value: MTLayerVisibility) -> Self -
Sets an inline filter expression for this layer.
Declaration
Swift
@discardableResult public func withFilter(_ value: MTPropertyValue) -> SelfParameters
valueFilter expression.
-
Declaration
Swift
public static func == (lhs: MTSymbolLayer, rhs: MTSymbolLayer) -> Bool