<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ShapeStyle/linearGradient(colors:startPoint:endPoint:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10ShapeStylePA2A14LinearGradientVRszrlE06linearF06colors10startPoint03endJ0AESayAA5ColorVG_AA04UnitJ0VANtFZ"
  },
  "title" : "linearGradient(colors:startPoint:endPoint:)"
}
-->

# linearGradient(colors:startPoint:endPoint:)

A linear gradient defined by a collection of colors.

```
@export(implementation) static func linearGradient(colors: [Color], startPoint: UnitPoint, endPoint: UnitPoint) -> LinearGradient
```

## Discussion

The gradient applies the color function along an axis, as defined by its
start and end points. The gradient maps the unit space points into the
bounding rectangle of each shape filled with the gradient.

For information about how to use shape styles, see [`ShapeStyle`](/documentation/SwiftUI/ShapeStyle).

---

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)