Giter Club home page Giter Club logo

simplecell's Introduction

Swift Build Status pod compatible Carthage compatible codecov

SimpleCell

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.3.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.3.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

simplecell's People

Contributors

devmjun avatar

Watchers

Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.