Latest 0.0.2
License MIT
Platforms ios 8.0, requires ARC

GitHub license

It’s lifetime mission for iOS developers to optimize the use of UITableView. Fortunately, I managed a brilliant and straightforward way to use it inspired by Arkadiusz Holko’s Article.

This approach allows crafting a tableView with different kind of cells much easier and faster.



pod 'DDTableViewController'


Drop files in Source folder into your project.

Use it

Adopt the protocol Updatable for all your UITableViewCell subclasses. Follow this format:

import DDTableViewController

class CustomCell:UITableViewCell{

struct CustomCellViewData {
    // Declare all properties you need to decorate the cell
    var image:UIImage

extension CustomCell: Updatable {
    typealias ViewData = CustomCellViewData
    func updateWithViewData(viewData: ViewData) {
        // Decorate your cell with the viewData
    static var height: CGFloat{
        // Return the height of your cell here
        return 200

Use [Array<CellConfiguratorType>] as the model layer. Forget about all UITableView delegate methods, CellConfiguratorType will handle it all automatically.
use DDTableViewController to initialize the table:

let cellConfigurators:[Array<CellConfiguratorType>] = [
    // section 0
        // section 0 row 0
        CellConfigurator<ImageCell>(viewData: ImageCellViewData(image: UIImage(named: "sample.png")!), initFromNib: false),
        // section 0 row 1
        CellConfigurator<TextCell>(viewData: TextCellViewData(text: "Hello World"), initFromNib: false)
    //section 1
        CellConfigurator<ImageCell>(viewData: ImageCellViewData(image: UIImage(named: "sample2.png")!), initFromNib: false)
    // ...

let tableVC = DDTableViewController(cellConfigurators: cellConfigurators)

Mission Complete! (See example in Demo folder)

Other APIs

Insert/Delete Cell

func insertCellAtIndexPath(indexPath indexPath:NSIndexPath, withCellConfigurator cellConfigurator:CellConfiguratorType, RowAnimation animation:UITableViewRowAnimation)
func deleteCellAtIndexPath(indexPath indexPath:NSIndexPath, withRowAnimation animation:UITableViewRowAnimation)

Reload Table

// Manually manipulate the model layer


func scrollToBottom(animated animated:Bool)
func scrollToTop(animated animated:Bool)

Best Practices

Load Web image In Cell Asynchronously

I recommend to use Kingfisher to Simplify Cell Logic

func updateWithViewData(viewData: ViewData) {

    imageView.kf_setImageWithURL(NSURL(string: viewData.imageURL)!,
                                 placeholderImage: nil,
                                 optionsInfo: nil,
                                 progressBlock: { (receivedSize, totalSize) -> () in
                                    print("Download Progress: (receivedSize)/(totalSize)")
                                 completionHandler: { (image, error, cacheType, imageURL) -> () in
                                    print("Downloaded and set!")

// when cell disappear, cancel the download task and later presentation.
override func prepareForReuse() {

Latest podspec

    "name": "DDTableViewController",
    "version": "0.0.2",
    "summary": "A brilliant way to use UITableView",
    "description": "It's lifetime mission for iOS developers to optimize the use of UITableView. Fortunately, I managed a brilliant way to use it inspired by [Arkadiusz Holko's Article](",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "u95fbu7aefCarl": "[email protected]"
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "0.0.2"
    "source_files": "Source/*.swift",
    "requires_arc": true

Pin It on Pinterest

Share This