devxoul / Reusablekit
Licence: mit
Generic reusables for UICollectionView and UITableView
Stars: ✭ 130
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Reusablekit
Feeds For Ios Developer
A list of rss feeds for iOS developers
Stars: ✭ 100 (-23.08%)
Mutual labels: cocoa
Bettersegmentedcontrol
An easy to use, customizable replacement for UISegmentedControl & UISwitch.
Stars: ✭ 1,782 (+1270.77%)
Mutual labels: cocoa
Xuikit
📦 XUIKIt is a UI framework for macOS, it extends a lot of methods similar to UIKit.
Stars: ✭ 90 (-30.77%)
Mutual labels: cocoa
Generic Auto Updater
Generic Auto-Updater: a robust, user-friendly, clean and efficient Auto-Updater to maintain any client patched.
Stars: ✭ 95 (-26.92%)
Mutual labels: generic
Genericdatasource
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift.
Stars: ✭ 127 (-2.31%)
Mutual labels: generic
Scroll
Scroll - making scrolling through buffers fun since 2016
Stars: ✭ 100 (-23.08%)
Mutual labels: generic
Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-3.85%)
Mutual labels: cocoa
Openquickly
A custom 'open quickly' window that imitates macOS' Spotlight
Stars: ✭ 78 (-40%)
Mutual labels: cocoa
Web Client
Generic Linked Data browser and UX component framework. Apache license.
Stars: ✭ 105 (-19.23%)
Mutual labels: generic
Alternativeicon Example
😱 Change your iOS application's icon programmatically since iOS 10.3
Stars: ✭ 129 (-0.77%)
Mutual labels: cocoa
Daterangepicker
The best (?) date range picker control for OS X.
Stars: ✭ 126 (-3.08%)
Mutual labels: cocoa
Typescript Tuple
Generics to work with tuples in TypeScript
Stars: ✭ 118 (-9.23%)
Mutual labels: generic
ReusableKit
Generic reusables for Cocoa. Currently supports UITableView
and UICollectionView
.
At a Glance
Before 🤢
collectionView.register(UserCell.self, forCellWithReuseIdentifier: "userCell")
collectionView.dequeueReusableCell(withReuseIdentifier: "userCell", for: indexPath) as! UserCell
- A hard-coded string identifier can cause a human error.
- A force downcasting should be avoided.
After 😊
let reusableUserCell = ReusableCell<UserCell>()
collectionView.register(reusableUserCell)
collectionView.dequeue(reusableUserCell) // UserCell
- A string identifier is generated automatically using UUID and stored in the struct.
- A generic can ensure the type of the dequeued cell statically.
Example Usage
It is recommended to define reusable types as a static constants in an enum
or a struct
.
UITableView
// 1. define
enum Reusable {
static let headerView = ReusableCell<SectionHeaderView>()
static let userCell = ReusableCell<UserCell>()
}
// 2. register
tableView.register(Reusable.headerView)
tableView.register(Reusable.userCell)
// 3. dequeue
tableView.dequeue(Reusable.headerView, for: indexPath)
tableView.dequeue(Reusable.userCell, for: indexPath)
UICollectionView
// 1. define
enum Reusable {
static let headerView = ReusableCell<SectionHeaderView>()
static let photoCell = ReusableCell<PhotoCell>()
}
// 2. register
collection.register(Reusable.headerView, kind: .header)
collection.register(Reusable.photoCell)
// 3. dequeue
collection.dequeue(Reusable.headerView, kind: .header, for: indexPath)
collection.dequeue(Reusable.photoCell, for: indexPath)
RxSwift Extension
ReusableKit supports a RxSwift extension.
users // Observable<[String]>
.bind(to: collectionView.rx.items(Reusable.userCell)) { i, user, cell in
cell.user = user
}
Contrubiting
Pull requests are welcomed 💖
In order to create Xcode project, run:
$ swift package generate-xcodeproj
Installation
-
For iOS 8+ projects with CocoaPods:
pod 'ReusableKit' pod 'ReusableKit/RxSwift' # with RxSwift extension
License
ReusableKit is under MIT license. See the LICENSE file for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].