---
title: segmentCount
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nssegmentedcell/segmentcount
---

# segmentCount

The number of segments in the segmented control.

## Declaration

```swift
var segmentCount: Int { get set }
```

## Discussion

Discussion This property contains the number of segments the segmented control should have. If this value is less than the number of segments currently in the control, segments are removed from the right of the control. Similarly, if the number is greater than the current number of segments, the new segments are added on the right. This value must be between 0 and 2049.

## See Also

### Related Documentation

- [Segmented Control Programming Guide](apple-archive/documentation/Cocoa/Conceptual/SegmentedControl.md)
