All Projects → ahmedAlmasri → SNAdapter

ahmedAlmasri / SNAdapter

Licence: MIT License
iOS swift tableview and collectionView Adapter

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to SNAdapter

TableViewExtension
This extension simplify registering any cell, reusing and other verbosity steps.
Stars: ✭ 13 (-62.86%)
Mutual labels:  generic, tableview, tableviewcell
Reactivelists
React-like API for UITableView & UICollectionView
Stars: ✭ 250 (+614.29%)
Mutual labels:  tableview, collectionview
GenericRecyclerAdapter
Easiest way to use RecyclerView. Reduce boilerplate code! You don't need to write adapters for listing pages anymore!
Stars: ✭ 53 (+51.43%)
Mutual labels:  adapter, generic
Pageable
An easy way to Pagination or Infinite scrolling for TableView/CollectionView
Stars: ✭ 44 (+25.71%)
Mutual labels:  tableview, collectionview
Rxrealmdatasources
An easy way to bind an RxRealm observable to a table or collection view
Stars: ✭ 154 (+340%)
Mutual labels:  tableview, collectionview
Swipetableview
Both scroll horizontal and vertical for segment scrollview which have a same header. — 类似半糖、美丽说主页与QQ音乐歌曲列表布局效果,实现不同菜单的左右滑动切换,同时支持类似tableview的顶部工具栏悬停(既可以左右滑动,又可以上下滑动)。兼容下拉刷新,自定义 collectionview实现自适应 contentSize 还可实现瀑布流功能
Stars: ✭ 2,252 (+6334.29%)
Mutual labels:  tableview, collectionview
SectionReactor
A ReactorKit extension for managing table view and collection view sections with RxDataSources
Stars: ✭ 45 (+28.57%)
Mutual labels:  tableview, collectionview
Modelassistant
Elegant library to manage the interactions between view and model in Swift
Stars: ✭ 26 (-25.71%)
Mutual labels:  tableview, collectionview
ZXTableView
快速、高效地构建TableView,节省80%以上重复代码,无需设置数据源和代理。
Stars: ✭ 18 (-48.57%)
Mutual labels:  tableview, tableviewcell
ReactiveDataDisplayManager
No description or website provided.
Stars: ✭ 35 (+0%)
Mutual labels:  tableview, tableviewcell
Emptykit
A lightweight, swift library for displaying emptyView whenever the view(tableView/collectionView) has no content to display, just like DZNEmptyDataSet
Stars: ✭ 117 (+234.29%)
Mutual labels:  tableview, collectionview
GenericAdapter
⛳️ Easy to use android databinding ready recyclerview adapter
Stars: ✭ 26 (-25.71%)
Mutual labels:  adapter, generic
Rxasdatasources
RxDataSource for AsyncDisplayKit/Texture
Stars: ✭ 114 (+225.71%)
Mutual labels:  tableview, collectionview
Rxdatasources
UITableView and UICollectionView Data Sources for RxSwift (sections, animated updates, editing ...)
Stars: ✭ 2,784 (+7854.29%)
Mutual labels:  tableview, collectionview
Tdbadgedcell
TDBadgedCell is a table view cell class that adds a badge, similar to the badges in Apple's own apps
Stars: ✭ 1,444 (+4025.71%)
Mutual labels:  tableview, tableviewcell
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+8265.71%)
Mutual labels:  adapter, tableview
Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (+680%)
Mutual labels:  tableview, collectionview
Diffabledatasources
💾 A library for backporting UITableView/UICollectionViewDiffableDataSource.
Stars: ✭ 601 (+1617.14%)
Mutual labels:  tableview, collectionview
ShortcutsCollectionView
Create custom collectionView like Apple’s Shortcuts app in Code.
Stars: ✭ 24 (-31.43%)
Mutual labels:  collectionview, collectionviewcell
ios-swift-uicollectionviewcell-from-xib
Create CollectionView Xib cell for UICollectionView using Swift 3
Stars: ✭ 12 (-65.71%)
Mutual labels:  collectionview, collectionviewcell

A declarative type-safe framework for building fast and flexible lists with TableView & CollectionView, No more delegates and datasource. Just a fully type-safe declarative content approach

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Using

Step 1: Import the SNAdapter module in swift.

import SNAdapter

TableView

Step 1: declare a new class or struct conform from SNCellableModel

struct MyModel: SNCellableModel {

  let title: String
}

Step 2: declare a new UITableViewCell conform from SNCellable

class MyCell: UITableViewCell, SNCellable {

  func configure(_ object: SNCellableModel?) {
    guard let myModel = object as? MyModel else { return }

    self.textLabel?.text = myModel.title
  }

}

Step 3: Take a reference to SNTableViewSection and SNTableViewAdapter into your controller.

 private var mySection: SNTableViewSection<MyModel, MyCell>!
 private var myAdapter: SNTableViewAdapter!

Step 4: Initialize the SNTableViewSection and SNTableViewAdapter in your viewDidLoad .

override func viewDidLoad() {
  super.viewDidLoad()
  ///....
  
  // MARK: - call setup section

  setupMySection()
  
  ///...
}

private func setupMySection() {

 mySection = SNTableViewSection<MyModel, MyCell>(items: getMyListData())
 myAdapter = SNTableViewAdapter(sections: [mySection])
 myTableView.setAdapter(myAdapter)
 
}

private func getMyListData() -> [MyModel] {

return [MyModel(title: "Item 1"), MyModel(title: "Item 2")]

}

More Example

CollectionView

Step 1: declare new UICollectionViewCell inherent form SNCellable

class MyCell: UICollectionViewCell, SNCellable {

 @IBOutlet weak var titleLabel: UILabel!
 
func configure(_ object: SNCellableModel?) {
guard let myModel = object as? MyModel else { return }

  titleLabel.text = myModel.title
}

}

Step 2: Take a reference to SNCollectionViewSection and SNCollectionViewAdapter into your controller.

private var mySection: SNCollectionViewSection<MyModel, MyCell>!
private var myAdapter: SNCollectionViewAdapter!

Step 3: Initialize the SNCollectionViewSection and SNCollectionViewAdapter in your viewDidLoad .

override func viewDidLoad() {
super.viewDidLoad()
///....

// MARK: - call setup section

setupMySection()

///...
}

private func setupMySection() {

mySection = SNCollectionViewSection<MyModel, MyCell>(items: getMyListData())
myAdapter = SNCollectionViewAdapter(sections: [mySection])
myCollectionView.setAdapter(myAdapter)

}

private func getMyListData() -> [MyModel] {

return [MyModel(title: "Item 1"), MyModel(title: "Item 2")]

}

More Example

Requirements

  • Swift 4.2+
  • Xcode 10.0+
  • iOS 11.0+

Installation

SNAdapter is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SNAdapter'

Author

ahmedAlmasri, [email protected]

License

SNAdapter is available under the 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].