---
title: numberOfColorStops
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsgradient/numberofcolorstops
---

# numberOfColorStops

The number of color stops associated with the gradient.

## Declaration

```swift
var numberOfColorStops: Int { get }
```

## Discussion

Discussion Gradients must have at least two color stops: one defining the location of the start color and one defining the location of the end color. Gradients may have additional color stops located at different transition points in between the start and end stops.

## See Also

### Getting Gradient Properties

- [colorSpace](appkit/nsgradient/colorspace.md)
- [getColor(_:location:at:)](appkit/nsgradient/getcolor(_:location:at:).md)
- [interpolatedColor(atLocation:)](appkit/nsgradient/interpolatedcolor(atlocation:).md)
