Marker
struct Marker
extension Marker : Copyable, Equatable, Escapable, Hashable, Identifiable, MapContent
A 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
a
andb
,a == b
implies thata != b
isfalse
.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:
clampToGround
Declaration
Swift
var altitudeMode: AltitudeMode
-
Specifies how a
Marker
should behave when it collides with anotherMarker
or with the default map labels.Default value:
required
Declaration
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:
clampToGround
Declaration
Swift
var drawsWhenOccluded: Bool
-
Specifies whether to connect the marker to the ground. To extrude a marker, the altitudeMode must be either
relativeToGround
,relativeToMesh
orabsolute
.Default value:
false
Declaration
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
Hashable
protocol. 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 thehasher
instance 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
hashValue
is deprecated as aHashable
requirement. To conform toHashable
, implement thehash(into:)
requirement instead. The compiler provides an implementation forhashValue
for 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:
false
Declaration
Swift
var sizePreserved: Bool
-
Declaration
Swift
func update(coordinator: RenderingCoordinator)
-
The zIndex compared to other 3D markers. By default,
Markers
are displayed according to their vertical position on screen, with lowerMarkers
appearing in front of
Markerfarther up the screen. Note that
zIndexis also used to help determine relative priority between
CollisionBehavior.optionalAndHidesLowerPriority3D markers. A higher
zIndex` value indicates higher priority.Default value:
clampToGround
Declaration
Swift
var zIndex: Int32