diff --git a/Sources/CommonAppleKit/CAListView.swift b/Sources/CommonAppleKit/CAListView.swift index 490d077..088feb4 100644 --- a/Sources/CommonAppleKit/CAListView.swift +++ b/Sources/CommonAppleKit/CAListView.swift @@ -8,7 +8,7 @@ import Foundation -open class CAListView: CACollectionView, CACollectionViewDataSource { +open class CAListView: CACollectionView, CACollectionViewDataSource, CACollectionViewDelegate { private let cellId: String #if canImport(UIKit) @@ -35,6 +35,7 @@ open class CAListView: CACollectionView, CACollectionViewD #if canImport(UIKit) dataSource = self #endif + delegate = self } required public init?(coder _: NSCoder) { @@ -49,7 +50,15 @@ open class CAListView: CACollectionView, CACollectionViewD public func collectionView(_ collectionView: CACollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> CACollectionViewCell { fatalError() } + + public func collectionView(_ collectionView: CACollectionView, willDisplay item: CACollectionViewCell, forRepresentedObjectAt indexPath: IndexPath) { + + } #elseif canImport(UIKit) + public func collectionView(_ collectionView: CACollectionView, didSelectItemAt indexPath: IndexPath) { + + } + public func collectionView(_ collectionView: CACollectionView, cellForItemAt indexPath: IndexPath) -> CACollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) (cell as? CAListViewCell)?.representedObject = content[indexPath.item]