UICollectionView
extension UICollectionView
-
Register a cell view type that implements ReusableView protocol.
Declaration
Swift
public func register<T>(_: T.Type) where T : UICollectionViewCell, T : ReusableView
Parameters
_
the cell class to register (ignored)
-
Register a cell view type that implements the NibLoadableView protocol.
Declaration
Swift
public func register<T: UICollectionViewCell>(_: T.Type) where T: ReusableView, T: NibLoadableView
Parameters
_
the cell class to register (ignored)
-
Obtain a cell view to use to render cell content in a collection view.
Declaration
Swift
public func dequeueReusableCell<T: UICollectionViewCell>(for indexPath: IndexPath) -> T where T: ReusableView
Parameters
indexPath
the location of the cell that is being rendered
Return Value
instance of a T class
-
Generic method to obtain the cell at a given index. Will return nil if index is invalid or not visible.
Declaration
Swift
public func cellForItem<T: UICollectionViewCell>(at indexPath: IndexPath) -> T? where T: ReusableView
Parameters
indexPath
the index to use
Return Value
optional cell of the indicated type