selectionIndexPaths
The set of index paths representing the currently selected items.
Declaration
var selectionIndexPaths: Set<IndexPath> { get set }Discussion
This property reflects the index paths of the currently selected items, where each index path contains a section number and an index number for the item in that section. This property is updated automatically when the user selects items interactively. You can also change the selection programmatically by assigning a new value to this property. To animate changes to the selection, call this method on the collection view’s animator() proxy object instead.
It is a programmer error to specify an index path that does not refer to a valid item in the data source. If you specify an invalid index path, this method raises an exception.
This property is key-value observable. Other methods that modify the selection automatically update this property.