---
title: selectedIndex
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsscrubber/selectedindex
---

# selectedIndex

The index of the selected item in the scrubber.

## Declaration

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

## Discussion

Discussion If no item is selected, the value of this property is -1. If you set this property through the scrubber’s animator proxy, the selection change animates. To use a scrubber’s animator proxy when changing the selected item, employ the NSAnimatablePropertyContainer protocol, using code like this: scrubber.animator.selectedIndex = 123

## See Also

### Getting the state of the scrubber

- [numberOfItems](appkit/nsscrubber/numberofitems.md)
- [highlightedIndex](appkit/nsscrubber/highlightedindex.md)
