https://github.com/puti94/commonadapter
swift版本的万能适配器。供参考,,项目慎用
https://github.com/puti94/commonadapter
swift
Last synced: 2 months ago
JSON representation
swift版本的万能适配器。供参考,,项目慎用
- Host: GitHub
- URL: https://github.com/puti94/commonadapter
- Owner: puti94
- Created: 2017-11-22T08:46:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-22T11:26:16.000Z (over 7 years ago)
- Last Synced: 2025-02-03T23:40:58.479Z (4 months ago)
- Topics: swift
- Language: Swift
- Size: 279 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CommonAdapter
用惯了Android 封装的万能适配器, 非常不习惯IOS UITableView和UICollectionView又要设置数据源又要设置协议等各种复杂的操作,封装了个适配器。由于视图操作没有和数据源分离,严格来讲不能叫做Adapter,I don`t care- 使用:把项目中的CommonAdapter文件夹拖到项目中
```
简单用法
需要一个UITableViewCell类似于Android的ViewHolder
class TableViewCell: XTableViewCell {
@IBOutlet weak var label: UILabel!
}
//在viewDidAppear方法里面创建TableAdapter实例
TableAdapter(tableView,datas: data, convert: { cell, item, position in
print(item)
cell.label.text = item
})
具体用法看Demo
```
## 效果图


