CollectionViewDelegate

@MainActor
open class CollectionViewDelegate : DelegateProxy<UICollectionViewDelegate>, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

常用集合视图数据源和事件代理,可继承

  • 集合section数

    Declaration

    Swift

    @MainActor
    open var numberOfSections: (() -> Int)?
  • 集合section数,默认1,优先级低

    Declaration

    Swift

    @MainActor
    open var sectionCount: Int
  • 集合item数句柄

    Declaration

    Swift

    @MainActor
    open var numberOfItems: ((Int) -> Int)?
  • 集合item数,优先级低

    Declaration

    Swift

    @MainActor
    open var itemCount: Int
  • 集合section边距句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var insetForSection: ((UICollectionView, Int) -> UIEdgeInsets)?
  • 集合section边距,默认nil

    Declaration

    Swift

    @MainActor
    open var sectionInset: UIEdgeInsets?
  • 集合section滚动方向最小平行间距句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var minimumLineSpacingForSection: ((UICollectionView, Int) -> CGFloat)?
  • 集合section滚动方向最小平行间距,默认nil

    Declaration

    Swift

    @MainActor
    open var minimumLineSpacing: CGFloat?
  • 集合section滚动方向最小垂直间距句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var minimumInteritemSpacingForSection: ((UICollectionView, Int) -> CGFloat)?
  • 集合section滚动方向最小垂直间距,默认nil

    Declaration

    Swift

    @MainActor
    open var minimumInteritemSpacing: CGFloat?
  • 集合section头视图句柄,size未指定时为automaticSize,默认nil

    Declaration

    Swift

    @MainActor
    open var viewForHeader: ((UICollectionView, IndexPath) -> UICollectionReusableView?)?
  • 集合section头视图类句柄,搭配headerConfiguration使用,默认nil

    Declaration

    Swift

    @MainActor
    open var viewClassForHeader: ((UICollectionView, IndexPath) -> UICollectionReusableView.Type?)?
  • 集合section头视图类,搭配headerConfiguration使用,默认nil,优先级低

    Declaration

    Swift

    @MainActor
    open var headerViewClass: UICollectionReusableView.Type?
  • 集合section头视图配置句柄,参数为headerClass对象,默认为nil

    Declaration

    Swift

    @MainActor
    open var headerConfiguration: ((UICollectionReusableView, IndexPath) -> Void)?
  • 集合section头尺寸句柄,不指定时默认使用FWDynamicLayout自动计算并按section缓存

    Declaration

    Swift

    @MainActor
    open var sizeForHeader: ((UICollectionView, Int) -> CGSize)?
  • 集合section头尺寸,默认nil,可设置为automaticSize,优先级低

    Declaration

    Swift

    @MainActor
    open var headerSize: CGSize?
  • 集合section尾视图句柄,size未指定时为automaticSize,默认nil

    Declaration

    Swift

    @MainActor
    open var viewForFooter: ((UICollectionView, IndexPath) -> UICollectionReusableView?)?
  • 集合section尾视图类句柄,搭配footerConfiguration使用,默认nil

    Declaration

    Swift

    @MainActor
    open var viewClassForFooter: ((UICollectionView, IndexPath) -> UICollectionReusableView.Type?)?
  • 集合section尾视图类,搭配footerConfiguration使用,默认nil,优先级低

    Declaration

    Swift

    @MainActor
    open var footerViewClass: UICollectionReusableView.Type?
  • 集合section头视图配置句柄,参数为headerClass对象,默认为nil

    Declaration

    Swift

    @MainActor
    open var footerConfiguration: ((UICollectionReusableView, IndexPath) -> Void)?
  • 集合section尾尺寸句柄,不指定时默认使用FWDynamicLayout自动计算并按section缓存

    Declaration

    Swift

    @MainActor
    open var sizeForFooter: ((UICollectionView, Int) -> CGSize)?
  • 集合section尾尺寸,默认nil,可设置为automaticSize,优先级低

    Declaration

    Swift

    @MainActor
    open var footerSize: CGSize?
  • 集合cell视图句柄,size未指定时为automaticSize,默认nil

    Declaration

    Swift

    @MainActor
    open var cellForItem: ((UICollectionView, IndexPath) -> UICollectionViewCell?)?
  • 集合cell视图类句柄,搭配cellConfiguration使用,默认nil

    Declaration

    Swift

    @MainActor
    open var cellClassForItem: ((UICollectionView, IndexPath) -> UICollectionViewCell.Type?)?
  • 集合cell类,搭配cellConfiguation使用,默认nil时为UITableViewCell.Type,优先级低

    Declaration

    Swift

    @MainActor
    open var cellClass: UICollectionViewCell.Type?
  • 集合cell配置句柄,参数为对应cellClass对象

    Declaration

    Swift

    @MainActor
    open var cellConfiguration: ((UICollectionViewCell, IndexPath) -> Void)?
  • 集合cell尺寸句柄,不指定时默认使用FWDynamicLayout自动计算并按indexPath缓存

    Declaration

    Swift

    @MainActor
    open var sizeForItem: ((UICollectionView, IndexPath) -> CGSize)?
  • 集合cell尺寸,默认nil,可设置为automaticSize,优先级低

    Declaration

    Swift

    @MainActor
    open var itemSize: CGSize?
  • 是否启用默认尺寸缓存,优先级低于cacheKey句柄,默认false

    Declaration

    Swift

    @MainActor
    open var sizeCacheEnabled: Bool
  • 集合cell自定义尺寸缓存key句柄,默认nil,优先级高

    Declaration

    Swift

    @MainActor
    open var cacheKeyForItem: ((IndexPath) -> AnyHashable?)?
  • 集合section头自定义尺寸缓存key句柄,默认nil,优先级高

    Declaration

    Swift

    @MainActor
    open var cacheKeyForHeader: ((Int) -> AnyHashable?)?
  • 集合section尾自定义尺寸缓存key句柄,默认nil,优先级高

    Declaration

    Swift

    @MainActor
    open var cacheKeyForFooter: ((Int) -> AnyHashable?)?
  • 集合选中事件,默认nil

    Declaration

    Swift

    @MainActor
    open var didSelectItem: ((UICollectionView, IndexPath) -> Void)?
  • 集合cell即将显示句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var willDisplayCell: ((UICollectionViewCell, IndexPath) -> Void)?
  • 集合cell即将停止显示,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndDisplayingCell: ((UICollectionViewCell, IndexPath) -> Void)?
  • 集合滚动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didScroll: ((UIScrollView) -> Void)?
  • 集合即将开始拖动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var willBeginDragging: ((UIScrollView) -> Void)?
  • 集合即将停止拖动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var willEndDragging: ((UIScrollView, CGPoint, UnsafeMutablePointer<CGPoint>) -> Void)?
  • 集合已经停止拖动句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndDragging: ((UIScrollView, Bool) -> Void)?
  • 集合已经停止减速句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndDecelerating: ((UIScrollView) -> Void)?
  • 集合已经停止滚动动画句柄,默认nil

    Declaration

    Swift

    @MainActor
    open var didEndScrollingAnimation: ((UIScrollView) -> Void)?

Lifecycle

  • 初始化并绑定collectionView

    Declaration

    Swift

    @MainActor
    public convenience init(collectionView: UICollectionView)

UICollectionViewDataSource

  • Undocumented

    Declaration

    Swift

    @MainActor
    open func numberOfSections(in collectionView: UICollectionView) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView

UICollectionViewDelegateFlowLayout

  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize

UICollectionViewDelegate

  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath)
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath)

UIScrollViewDelegate