---
title: numberOfComponents
framework: coregraphics
role: symbol
role_heading: Instance Property
path: coregraphics/cgcolorspace/numberofcomponents
---

# numberOfComponents

Returns the number of color components in a color space.

## Declaration

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

## Discussion

Discussion A color space defines an n-dimensional space whose dimensions (or components) represent intensity values. Use this function to obtain the number of components in a given color space: for example, in an RGB color space this function returns 3 (for the three intensity values red, green, and blue).

## See Also

### Examining a Color Space

- [baseColorSpace](coregraphics/cgcolorspace/basecolorspace.md)
- [model](coregraphics/cgcolorspace/model.md)
- [CGColorSpaceModel](coregraphics/cgcolorspacemodel.md)
- [colorTable](coregraphics/cgcolorspace/colortable.md)
- [copyICCData()](coregraphics/cgcolorspace/copyiccdata().md)
- [copyPropertyList()](coregraphics/cgcolorspace/copypropertylist().md)
- [iccData](coregraphics/cgcolorspace/iccdata.md)
- [name](coregraphics/cgcolorspace/name.md)
- [supportsOutput](coregraphics/cgcolorspace/supportsoutput.md)
- [isWideGamutRGB](coregraphics/cgcolorspace/iswidegamutrgb.md)
