Model
@MainActor
@preconcurrency
struct Modelextension Model : MapContent, MapContentTappable, Sendable, SendableMetatype, ViewA 3D model that can be placed on a map.
Map(mode: .hybrid) {
Model(
position: .init(latitude: 37.7749, longitude: -122.4194, altitude: 100),
url: URL(string: "path/to/your/model.glb")!
)
}
-
The type of view representing the body of this view.
When you create a custom view, Swift infers this type from your implementation of the required
View/body-swift.propertyproperty.Declaration
Swift
typealias Body = some View -
Declaration
Swift
@MainActor @preconcurrency var altitudeMode: AltitudeMode -
The content and behavior of the view.
When you implement a custom view, you must implement a computed
bodyproperty to provide the content for your view. Return a view that’s composed of built-in views that SwiftUI provides, plus other composite views that you’ve already defined:struct MyView: View { var body: some View { Text("Hello, World!") } }For more information about composing views and a view hierarchy, see doc:Declaring-a-Custom-View.
Declaration
Swift
@MainActor @preconcurrency var body: some View { get } -
Declaration
Swift
@MainActor @preconcurrency init(position: LatLngAltitude, url: URL, altitudeMode: AltitudeMode = .clampToGround, zIndex: Int32 = 0, scale: Vector3D = .init(x: 1.0, y: 1.0, z: 1.0), orientation: Orientation3D = .init(heading: 0, tilt: 0, roll: 0)) -
Declaration
Swift
@MainActor @preconcurrency var orientation: Orientation3D -
Position of the model.
Declaration
Swift
@MainActor @preconcurrency var position: LatLngAltitude -
Declaration
Swift
@MainActor @preconcurrency var scale: Vector3D -
Declaration
Swift
@MainActor @preconcurrency var url: URL -
Declaration
Swift
@MainActor @preconcurrency var zIndex: Int32