CollectionViewCell
open class CollectionViewCell : CollectionReusableView
A CollectionViewCell object presents the content for a single data item when that item is within the collection view’s visible bounds. You can use this class as-is or subclass it to add additional properties and methods. The layout and presentation of cells is managed by the collection view and its corresponding layout object.
-
The highlight state of the cell.
Declaration
Swift
public var highlighted: Bool { get set }
-
The selection state of the cell.
Declaration
Swift
public var selected: Bool { get set }
-
Declaration
Swift
open override func prepareForReuse()
-
Provide a reuse identifier for all cells of this class, defaults to the class name
Declaration
Swift
open class var defaultReuseIdentifier: String { get }
-
Register a CollectionViewCell subclass to a collection view using the class’s defaultReuseIdentifier
Declaration
Swift
open class func register(in collectionView: CollectionView)
Parameters
collectionView
The collection view to register the class in
-
Deque a cell of this class from a collection view. Uses defaultReuseIdentifier
Declaration
Swift
open class func deque(for indexPath: IndexPath, in collectionView: CollectionView) -> CollectionViewCell
Parameters
indexPath
The indexPath to deque the cell for
collectionView
The collection view to deque the cell from
Return Value
A valid CollectionViewCell