https://github.com/kimdv/swiftyreuse
https://github.com/kimdv/swiftyreuse
reusable swift uikit
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kimdv/swiftyreuse
- Owner: kimdv
- License: mit
- Created: 2017-10-29T12:36:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T14:37:20.000Z (over 8 years ago)
- Last Synced: 2025-06-28T17:44:43.784Z (12 months ago)
- Topics: reusable, swift, uikit
- Language: Swift
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftyReuse
##### A micro framework that makes it more pretty to register and dequeue cells in `UITableView` and `UICollectionView`.
## Introduction
The `UIKit` way of registering `UITableView` or `UICollectionView` cells is not that sweet 🙈🙈🙈
```swift
self.tableView.register(UINib(nibName: "Cell", bundle: nil), forCellReuseIdentifier: "CellIdentifier")
```
And dequeue
```swift
return tableView.dequeueReusableCell(withIdentifier: "CellIdentifier", for: indexPath) as! CustomCell
```
Let's do that better with the power of Swift ! 🚀🚀🚀
```swift
class ViewController {
func viewDidLoad() {
self.collectionView.register(Cell.self)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return collectionView.dequeue(Cell.self, for: indexPath)
}
}
```
And that's it! 😱😱😱