This library allows you to specify a custom UIKit view as reusable, providing simple shorthand and type-safety for common types like UICollectionViewCell, UITableViewCell, and other views which can be loaded from a storyboard or nib.
class CustomTableViewCell: UITableViewCell, UIReusableView { }
class CustomCollectionViewCell: UICollectionViewCell, UIReusableView { }
override func viewDidLoad() {
super.viewDidLoad()
CustomTableViewCell.register(in: tableView)
}
override func viewDidLoad() {
super.viewDidLoad()
CustomCollectionViewCell.register(in: collectionView)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: CustomTableViewCell = .dequeue(from: tableView, at: indexPath)
return cell
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell: CustomCollectionViewCell = .dequeue(from: collectionView, at: indexPath)
return cell
}
link |
Stars: 1 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics