A Swift Extension for Reusable Collection View and TableView Cell.
tableView.register(UItableViewCell, forCellWithReuseIdentifier: "Cell")
tableView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! UserCellIt can cause a mistake if writing an identifier manually.
tableView.register(cell: TableViewCell.self)
let cell = tableView.dequeue(TableViewCell.self)an identifier is generated automatically with the same name as its class name.
// 1. register
tableView.register(cell: TableViewCell.self)
// 2. dequeue
tableView.dequeue(TableViewCell.self)
// or
tableView.dequeue(TableViewCell.self, indexPath: indexPath)// 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)SimpleCell requires iOS 8 or above and is written in Swift 5.0
CaseContainer is available through CocoaPods. To install it, simply add the following line to your podfile:
pod 'SimpleCell', '~> 0.7.0'And run pod install.
CaseContainer is available through Carthage. Simply install carthage with Homebrew using the following command:
$ brew update
$ brew install carthageadd CaseContainer to your Cartfile:
github "devmjun/SimpleCell" ~> 0.7.0
And run carthage update.
Bug reports, pull request and any discussion are welcome
SimpleCell is available as open source under the terms of the MIT License