• Stars
    star
    178
  • Rank 214,989 (Top 5 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 8 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RGListKit is a Protocol & MVVM based framework to easily populate a UITableView or UICollectionView via single api.

RGListKit

RGListKit is a Protocol & MVVM based framework for populating UITableView & UICollectionView. It takes care of batch-reload as well which is powered by Dwifft.

Features

  • No need to call reloadData()
  • No need to manage indexPaths to performBatchUpdates(_:, completion:)
  • No need to use different apis to populate UITableView & UICollectionView
  • It works with multiple sections
  • It works with multiple cell types
  • ListableView, a protocol which unifies UITableView & UICollectionView
  • ListManager takes care of populating a ListableView
  • [sections] is all you need to set which acts like a datasource to populate a ListableView
  • ItemModel, a protocol which unifies UITableViewCell & UICollectionViewCell
  • Every cell is populated/configured via an ItemModel which is based on MVVM pattern
  • Decoupled diffing algorithm, powered by Dwifft
  • Extendible API
  • Written completely in Swift

Installation

Cocoapods

To integrate RGListKit into your Xcode project using CocoaPods, specify it in your Podfile:

Swift 3.1

  pod 'RGListKit', :git => 'https://github.com/riteshhgupta/RGListKit.git', :branch => 'swift3'

Swift 4.0

  pod 'RGListKit', :git => 'https://github.com/riteshhgupta/RGListKit.git'

Swift 4.0 + ReactiveSwift

  pod 'RGListKit/ReactiveSwift', :git => 'https://github.com/riteshhgupta/RGListKit.git', :branch => 'swift4'

Example

UITableView

...
		let tableView = UITableView()
		let cellModels: [ItemModel] = [...]
		let sectionModel = SectionModel(id: "section-one-id", cells: cellModels)
		
		listManager = ListManager(listView: tableView)
		listManager.sections = [sectionModel]
...

UICollectionView

...
		let collectionView = UICollectionView()
		let cellModels: [ItemModel] = [...]
		let sectionModel = SectionModel(id: "section-one-id", cells: cellModels)
		
		listManager = ListManager(listView: collectionView)
		listManager.sections = [sectionModel]
...

Internal Architecture

  • As you can see the api for populating UITableView or UICollectionView is identical, one of the benefits of using RGListKit.
  • ItemModel defines a cell or even a header/footer-view for both UITableViewCell & UICollectionViewCell
  • ListManager has a property sections which when set triggers the view update
  • All the updates are by default batch-update but you can turn it off by setting shouldPerformBatchUpdate = false
  • You don't have to worry about indexPaths anymore, it uses diffing of old & new array of sections which calculates & performs the update for you.
  • It doesn't intefere at all with custom views, like custom table cell or custom layout for collection view. RGListKit only takes care of your datasource and not the UI appearance. So you are free to use any custom layouts as required along with RGListKit.
  • Since RGListKit consumes both delegate & datasource so you can simply extend ListManager to handle any custom use cases like didSelect when required. All the methods will be available under ListManager e.g.
// UICollectionView

extension ListManager {
	public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
	}
}
// UITableView

extension ListManager {
	public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
	}
}
  • There are couple of examples in the project itself which you can checkout or create an issue or ping me if anything comes up πŸ‘

Blogs/Newsletter

List of online sources which have mentioned RGListKit,

Contributing

Contributions are welcome and encouraged! Open an issue or submit a pull request πŸš€

Licence

RGListKit is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

TagCellLayout

Made in Swift - Tag layout for UICollectionView supporting 3 types of alignments - Left || Centre || Right
Swift
357
star
2

awesome-combine

A collaborative list of awesome Combine resources and libraries. Feel free to contribute!
62
star
3

PullToRefreshPaginationManager

Made in Swift - PullToRefreshPaginationManager allows you to have Refresh (pull-to-refresh) & Pagination (load-more) functionality with just few lines of code.
Swift
11
star
4

swift-delhi

Swift-Delhi is swift meetup group in delhi for developers who are working or willing to learn Swift - a programming language by Apple to primarily make applications for Apple ecosystem.
Swift
8
star
5

RGBottomSheet

RGBottomSheet is an iOS UI component which presents a dismissible view from the bottom of the screen!
Swift
6
star
6

combine-demo-swiftindia

It's a demo project explaining `Combine` with couple of examples.
Swift
4
star
7

SwiftAnytime

SwiftAnytime
Swift
3
star
8

RGDependencyInjector

RGDependencyInjector is a protocol oriented dependency injection Β΅-framework for iOS.
Swift
3
star
9

jarvis

Shell
2
star
10

mvi-ios

Swift
2
star
11

reklaim

Kotlin
2
star
12

try-swift-beginner-workshop

Swift Beginner Workshop Content –– try!Swift Bangalore 2017
Swift
2
star
13

RGStoreKit

*RGStoreKit* is a protocol oriented persistence framework for iOS apps.
Swift
2
star
14

swift-snippets

1
star
15

ProtoKit

ProtoKit is a protocol oriented UIKit!
Swift
1
star
16

kotlin-resources

A list of helpful resources related to Kotlin!
1
star
17

RGRoutable

RGRoutable is a protocol oriented library to handle screen navigation/routing in iOS.
Swift
1
star
18

RGMapper

Its safely maps `Any` (could be api response) into custom types.
Swift
1
star
19

RGToolKit

Its a collection of some awesome swifty functions, extensions, properties which could speed up your Swift development!!!
Swift
1
star