<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/AnyGradient",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11AnyGradientV"
  },
  "title" : "AnyGradient"
}
-->

# AnyGradient

A color gradient.

```
@frozen struct AnyGradient
```

## Overview

When used as a [`ShapeStyle`](/documentation/SwiftUI/ShapeStyle), this type draws a linear gradient
with start-point [0.5, 0] and end-point [0.5, 1].

## Topics

### Creating a gradient

[`init(_:)`](/documentation/SwiftUI/AnyGradient/init(_:))

Creates a new instance from the specified gradient.

### Working with color spaces

[`colorSpace(_:)`](/documentation/SwiftUI/AnyGradient/colorSpace(_:))

Returns a version of the gradient that will use a specified
color space for interpolating between its 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)