Latest 0.6.0
Homepage https://github.com/devmjun/simplecell
License MIT
Platforms ios 8.0
Authors

Swift Build Status pod compatible Carthage compatible codecov

A Swift Extension for Reusable Collection View and TableView Cell.

Summary

Before

tableView.register(UItableViewCell, forCellWithReuseIdentifier: "Cell")
tableView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! UserCell

It can cause a mistake if writing an identifier manually.

After

tableView.register(cell: TableViewCell.self)
let cell = tableView.dequeue(TableViewCell.self)

an identifier is generated automatically with the same name as its class name.

Usage

TableView

// 1. register
tableView.register(cell: TableViewCell.self)

// 2. dequeue 
tableView.dequeue(TableViewCell.self)
// or
tableView.dequeue(TableViewCell.self, indexPath: indexPath)

CollectionView

// 1. register
collectionView.register(cell: CollectionViewCell.self)
// or when using supplementary views. 
collectionView.register(cell: CollectionReusableView.self, forSupplementaryViewOfKind: .header)
collectionView.register(cell: CollectionReusableView.self, forSupplementaryViewOfKind: .footer)

// 2. dequeue 
collectionView.dequeue(CollectionView.self)
// or when using supplementary views. 
collectionView.dequeue(CollectionReusableHeaderView.self, .header, indexPath: indexPath)
collectionView.dequeue(CollectionReusableFooterView.self, .footer, indexPath: indexPath)

Requirements

SimpleCell requires iOS 8 or above and is written in Swift 4.2.

Installation

CocoaPods

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

pod 'SimpleCell', '~> 0.6.0'

And run pod install.

Carthage

CaseContainer is available through Carthage. Simply install carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

add CaseContainer to your Cartfile:

github "devmjun/SimpleCell" ~> 0.6.0

And run carthage update.

Contributing

Bug reports, pull request and any discussion are welcome

License

SimpleCell is available as open source under the terms of the MIT License

Latest podspec

{
    "name": "SimpleCell",
    "version": "0.6.0",
    "summary": "The Simple Cell is A Swift Extension for Reusable Collection View Cell and Table View Cell",
    "homepage": "https://github.com/devmjun/simplecell",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "devmjun": "[email protected]"
    },
    "source": {
        "git": "https://github.com/devmjun/SimpleCell.git",
        "tag": "0.6.0"
    },
    "source_files": "Sources/*",
    "exclude_files": "Sources/*.plist",
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This