<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISegmentedControl/selectedSegmentIndex",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UISegmentedControl(py)selectedSegmentIndex"
  },
  "title" : "selectedSegmentIndex"
}
-->

# selectedSegmentIndex

The index number that identifies the selected segment that the user last touched.

```
var selectedSegmentIndex: Int { get set }
```

## Discussion

The default value is [`noSegment`](/documentation/UIKit/UISegmentedControl/noSegment) (no segment selected) until the user touches a segment. Set this property to `-1` to turn off the current selection. [`UISegmentedControl`](/documentation/UIKit/UISegmentedControl) ignores this property when [`isMomentary`](/documentation/UIKit/UISegmentedControl/isMomentary) is <doc://com.apple.documentation/documentation/Swift/true>. When the user touches a segment to change the selection, the system generates the control event [`valueChanged`](/documentation/UIKit/UIControl/Event/valueChanged). If you set up the segmented control to respond to this control event, it sends an action message to its target.

---

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)