Instance Property

allowsMultipleSelection

A Boolean value that determines whether users can select more than one item in the collection view.

Declaration

var allowsMultipleSelection: Bool { get set }

Discussion

This property controls whether multiple items can be selected simultaneously. The default value of this property is false.

When the value of this property is true, tapping a cell adds it to the current selection (assuming the delegate permits the cell to be selected). Tapping the cell again removes it from the selection.

See Also

Managing the Selection

var allowsSelection: Bool

A Boolean value that indicates whether users can select items in the collection view.

var indexPathsForSelectedItems: [IndexPath]?

The index paths for the selected items.

func selectItem(at: IndexPath?, animated: Bool, scrollPosition: UICollectionView.ScrollPosition)

Selects the item at the specified index path and optionally scrolls it into view.

func deselectItem(at: IndexPath, animated: Bool)

Deselects the item at the specified index.