Marker
struct Markerextension Marker : Copyable, Equatable, Escapable, Hashable, Identifiable, MapContentA 3D marker that can be placed on a map.
Map(mode: .hybrid) {
Marker(position: .init(latitude: 37.7749, longitude: -122.4194, altitude: 0))
}
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
aandb,a == bimplies thata != bisfalse.Declaration
Swift
static func == (a: Marker, b: Marker) -> Bool -
A type representing the stable identity of the entity associated with an instance.
Declaration
Swift
@available(watchOS, introduced: 6.0) @available(macOS, introduced: 10.15) @available(iOS, introduced: 13.0) @available(tvOS, introduced: 13.0) typealias ID = String -
Declaration
Swift
func add(coordinator: RenderingCoordinator) -
Specifies how altitude in the position is interpreted.
Default value:
clampToGroundDeclaration
Swift
var altitudeMode: AltitudeMode -
Specifies how a
Markershould behave when it collides with anotherMarkeror with the default map labels.Default value:
requiredDeclaration
Swift
var collisionBehavior: CollisionBehavior -
Specifies whether this marker should be drawn or not when it’s occluded. The marker can be occluded by map geometry (e.g. buildings).
Default value:
clampToGroundDeclaration
Swift
var drawsWhenOccluded: Bool -
Specifies whether to connect the marker to the ground. To extrude a marker, the altitudeMode must be either
relativeToGround,relativeToMeshorabsolute.Default value:
falseDeclaration
Swift
var extruded: Bool -
Hashes the essential components of this value by feeding them into the given hasher.
Implement this method to conform to the
Hashableprotocol. The components used for hashing must be the same as the components compared in your type’s==operator implementation. Callhasher.combine(_:)with each of these components.Important
In your implementation of
hash(into:), don’t callfinalize()on thehasherinstance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.Declaration
Swift
func hash(into hasher: inout Hasher) -
The hash value.
Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.
Important
hashValueis deprecated as aHashablerequirement. To conform toHashable, implement thehash(into:)requirement instead. The compiler provides an implementation forhashValuefor you.Declaration
Swift
var hashValue: Int { get } -
Unique identifier
Declaration
Swift
let id: String -
init(position:altitudeMode:collisionBehavior:extruded:drawsWhenOccluded:sizePreserved:zIndex:label:)
Declaration
Swift
init(position: LatLngAltitude, altitudeMode: AltitudeMode = .clampToGround, collisionBehavior: CollisionBehavior = .required, extruded: Bool = false, drawsWhenOccluded: Bool = false, sizePreserved: Bool = false, zIndex: Int32 = 0, label: String = "") -
Text to be displayed by this marker.
Defaults to empty string.
Declaration
Swift
var label: String -
Sets the position.
Declaration
Swift
var position: LatLngAltitude -
Declaration
Swift
func remove(coordinator: RenderingCoordinator) -
Specifies whether this marker should preserve its size or not regardless of distance from camera. By default the marker is scaled based on distance from camera/tilt.
Default value:
falseDeclaration
Swift
var sizePreserved: Bool -
Declaration
Swift
func update(coordinator: RenderingCoordinator) -
The zIndex compared to other 3D markers. By default,
Markersare displayed according to their vertical position on screen, with lowerMarkersappearing in front ofMarkerfarther up the screen. Note thatzIndexis also used to help determine relative priority betweenCollisionBehavior.optionalAndHidesLowerPriority3D markers. A higherzIndex` value indicates higher priority.Default value:
clampToGroundDeclaration
Swift
var zIndex: Int32