<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/MeshGradient/init(width:height:bezierPoints:resolvedColors:background:smoothsColors:colorSpace:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12MeshGradientV5width6height12bezierPoints14resolvedColors10background07smoothsJ010colorSpaceACSi_SiSayAC11BezierPointVGSayAA5ColorV8ResolvedVGAOSbAA0D0V0qN0Vtcfc"
  },
  "title" : "init(width:height:bezierPoints:resolvedColors:background:smoothsColors:colorSpace:)"
}
-->

# init(width:height:bezierPoints:resolvedColors:background:smoothsColors:colorSpace:)

Creates a new gradient mesh specified as a 2D grid of colored
points, specifying the Bezier control points explicitly, with
already-resolved sRGB colors.

```
@export(implementation) nonisolated init(width: Int, height: Int, bezierPoints: [MeshGradient.BezierPoint], resolvedColors: [Color.Resolved], background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)
```

## Parameters

`width`

the width of the mesh, i.e. the number of vertices
per row.

`height`

the height of the mesh, i.e. the number of vertices
per column.

`bezierPoints`

the array of points and control points,
containing `width x height` elements.

`resolvedColors`

the array of colors, containing `width x height` elements.

`background`

the background color, this fills any points
outside the defined vertex mesh.

`smoothsColors`

whether cubic (smooth) interpolation should
be used for the colors in the mesh (rather than only for the
shape of the mesh).

`colorSpace`

the color space in which to interpolate vertex
colors.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)