Skip to content
Dequer is a light weight library to deque Any Cell
Swift Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Dequer is Light weight library to handle Any Cell

Platforms Language Build Test Document License Requirement


Dequer is a light weight library to handle Any Cell

One of the most used things in iOS development is deque UITableViewCell or UICollectionViewCell through DataSources and it has some configuration. I maded an extension and protocol which reuse a cell as clean as possible.


for the completion handler block used in protocol which is a closure , every Cell class should mark with final this means that can not be override this class or use it as superclass and block inheritance.

Protocol oriented

every Cell class which conforms to Dequer can use this code.


inside Cell there is a static variable named height for UITableViewCell and size for UICollectionViewCell which can store the default height of that cell. this one in optional and you can remove it.


  • iOS 9.3+
  • Swift 4.0+

Also fully compatible with Swift version 5.x



CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Dequer into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Dequer', :git => ''

Swift Package Manager

You can use The Swift Package Manager to install Dequer by adding the dequer package description to your Package.swift file:

// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .package(url: "", from: "1.2.3"),

Then run swift build in Terminal to build Dequer.


If you prefer not to use any of the aforementioned dependency managers, you can use source code manually. get latest relase from Releases.


Example project

Clone the project and use example project for more. Also documents are available.

Example of how to implement Dequer in your project.

import UIKit
import Dequer

final class PersonCell: UITableViewCell, Dequer {

    static var height: CGFloat = 40

    override func awakeFromNib() {



inside UITableViewDataSource

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    return PersonCell.deque(in: tableView, at: indexPath) { (cell, row) in
        cell.textLabel?.text = \(row)

Data Binding

As binding data in cellForRowAt or cellForItemAt should be avoided, I maded a method called bind which can use for data binding In This Commit.

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    return AnimalCell.deque(in: collectionView, at: indexPath)

override func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
    AnimalCell.bind(to: cell) {
        $0.animal = self.animals[indexPath.row]


Follow and contact me on Instagram, Github, LinkedIn or stack overflow. If you find an issue open a ticket. You can send me email at .


Dequer is released under the MIT license.

You can’t perform that action at this time.