CocoaPods trunk is moving to be read-only. Read more on the blog, there are 8 months to go.

kelei

2pods

Centipede

一个 Swift 库,使用闭包实现 UIKit 等组件的 delegate 和 dataSource 方法

解决什么问题

在实现 delegate 的各个方法时:

方法遍布整个 ViewController,散乱。 具体的实现与成员变量被分开了,阅读时需要分开查看。 如果 ViewController 中实现多个 UITableViewDataSource 时,方法中需要判断组件来做出反应。如下:(这很丑) func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return tableView == leftTableView ? leftDatas.count : rightDatas.count } 这些情况让代码不易阅读和维护。

希望:

代码连续。组件的构造、样式设置和各 delegate 实现方法可写在一个位置。 独立。有多个 UITableView 时,tableViewA 和tableViewB 的 delegate 方法实现是独立的,互不干扰。

License: MIT

  • Swift

KLTableViewAndCollectionViewPlaceholder

A line of code implements the UITableView and UICollectionView placeholders.

License: MIT

  • Objective C