body
TypeScriptget body(): Promise<never>Swift declaration@MainActor @preconcurrency var body: Never { get }struct · iOS 26.0+ · SDK 27.1
@MainActor @preconcurrency struct SurfacePlotChart content that represents a mathematical function of two variables using a 3D surface. Use `SurfacePlot` to visualize a 3D surface for functions of the form `y = f(x, z)` ## Overview To create a `SurfacePlot`, provide a closure that takes `x` and `z` values as input and returns a `y` value. For example, to draw the function `y = sin(2 * x) * cos(2 * z)`, you write: ```swift Chart3D { SurfacePlot(x: "x", y: "y", z: "z") { x, z in sin(2 * x) * cos(2 * z) } .foregroundStyle(.heightBased) } .chartXScale(domain: -2...2) .chartYScale(domain: -1...1) .chartZScale(domain: -2...2) ``` You can also explicitly define the plotting space of your `Chart3D` using the ``Chart/chartXScale(domain:range:type:)->View``, ``Chart/chartYScale(domain:range:type:)->View``, and ``Chart/chartYScale(domain:range:type:)->View`` modifiers. ## Styling the Surface You can style the surface using standard Swift Charts modifiers like ``foregroundStyle(_:)-(Chart3DSurfaceStyle)->Chart3DContent``. You may find this useful for Charts that contain more than one `SurfacePlot`. A common and effective style for surfaces is ``Chart3DSurfaceStyle/heightBased``, which creates a gradient using colors based on the y-value of your surface, making it easier to perceive its shape. You can also use ``Chart3DSurfaceStyle/normalBased`` to color points on the `SurfacePlot` based on the direction that it is facing. ```swift Chart3D { SurfacePlot(x: "x", y: "y", z: "z") { x, z in sin(2 * x) * cos(2 * z) * 0.5 } .foregroundStyle(.heightBased) SurfacePlot(x: "x", y: "y", z: "z") { x, z in sin(4 * x) * cos(4 * z) * 0.2 - 1 } .foregroundStyle(.normalBased) } .chartXScale(domain: -2...2) .chartYScale(domain: -1.5...1) .chartZScale(domain: -2...2) ```
get body(): Promise<never>Swift declaration@MainActor @preconcurrency var body: Never { get }4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
SurfacePlot.init(x:y:z:function:)
callback cannot propagate synchronous failure
SurfacePlot.init(x:y:z:function:)
callback cannot propagate synchronous failure
SurfacePlot.init(x:y:z:function:)
callback cannot propagate synchronous failure
SurfacePlot.init(x:y:z:function:)
callback cannot propagate synchronous failure