Swiftpack.co - pkh0225/CollectionViewAdapter as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by pkh0225.
pkh0225/CollectionViewAdapter v1.0.0
CollectionView adpter
⭐️ 2
πŸ•“ 47 weeks ago
.package(url: "https://github.com/pkh0225/CollectionViewAdapter.git", from: "v1.0.0")

CollectionViewAdapter

CollectionView adpter

No UICollectionView Delegate, DataSource


SampleTestApp

↑↑ please refer test sample project πŸ‘ΎπŸ‘Ύ


sample data set

        DispatchQueue.global().async {
            
            var testData = UICollectionViewAdapterData()
            for i in 0...10 {
                let sectionInfo = UICollectionViewAdapterData.SectionInfo()
                testData.sectionList.append(sectionInfo)
                sectionInfo.header = UICollectionViewAdapterData.CellInfo(contentObj: "@@ header @@ \(i)",
                                             sizeClosure: { return CGSize(width: UIScreen.main.bounds.size.width, height: 150) },
                                                cellType: TestCollectionReusableView.self) { (name, object) in
                                                    guard let object = object else { return }
                                                    print("header btn ---- \(name) : \(object)")
                                                }
                sectionInfo.footer = UICollectionViewAdapterData.CellInfo(contentObj: " --- footer --- \(i)", cellType: TestFooterCollectionReusableView.self)
                for j in 0...5 {
                    let cellInfo = UICollectionViewAdapterData.CellInfo(contentObj: "cell \(j)",
                                           sizeClosure: { return CGSize(width: UIScreen.main.bounds.size.width, height: 50) },
                                              cellType: TestCollectionViewCell.self) { (name, object) in
                                                    guard let object = object else { return }
                                                    print("cell btn ---- \(name) : \(object)")
                                             }
                    sectionInfo.cells.append( cellInfo )
                }
            }
            
            DispatchQueue.main.async {
                self.collectoinView.adapterData = testData
                self.collectoinView.reloadData()
            }
        }

GitHub

link
Stars: 2
Last commit: 4 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

public μΆ”κ°€
4 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics