Skip to content

pkh0225/TableViewAdapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TableViewAdapter

SwiftPM compatible

No UITableView Delegate, DataSource

NO Cell Register


timetable

↑↑ please refer test sample project 👾👾


sample data set

            
        let testData = TableViewAdapterData()
        for i in 0...10 {
            let sectionInfo = TVASectionInfo()
            testData.sectionList.append(sectionInfo)
            sectionInfo.header = TVAHeaderFooterInfo(cellType: TestHeaderFooterView.self)
                .setContentObj("@@ header @@ \(i)\n1247\nasdighj")
                .setActionClosure({ [weak self] (name, object) in
                    guard let self else { return }
                    guard let object = object else { return }

                    self.alert(title: "", message: "\(object) : \(name)")
                })

            sectionInfo.footer = TVAHeaderFooterInfo(cellType: TestHeaderFooterView.self)
                .setContentObj(" --- footer --- \(i)\nasdlk;fj\n213p4987")
                .setActionClosure({ [weak self] (name, object) in
                    guard let self else { return }
                    guard let object = object else { return }
                    self.alert(title: "", message: "\(object) : \(name)")
                })

            for j in 0...3 {
                let contentObj: String
                if #available(iOS 14.0, *) {
                    // cell auto size test
                    contentObj = "cell (\(i) : \(j))\n12351235\n1235512345"
                }
                else {
                    // cell fix size
                    contentObj = "cell (\(i) : \(j))"
                }

                let cellInfo = TVACellInfo(cellType: TestTableViewCell.self)
                    .setContentObj(contentObj)
                    .setActionClosure({ [weak self] (name, object) in
                        guard let self else { return }
                        guard let object = object else { return }
                        self.alert(title: name, message: "\(object)")
                    })

                sectionInfo.cells.append(cellInfo)
            }

            self.tableView.adapterData = testData
            self.tableView.reloadData()
        

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages