Skip to content

eonist/ReusableCell

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

SPM compatible SwiftLint Sindre

Features

  • Makes dequeuing cells simpler
  • Supports UITableView and UICollectionView
  • Supports UITableViewCell and UICollectionViewCell

Installation

  • SPM: .package(url: "https://github.com/eonist/ReusableCell", .branch("master"))

Example 1:

import ReusableCell_iOS
tableView.register(CustomCell.self) // Register Cells with ease
extension CustomCell: ReusableCell {} // Make your custom cells
let cell: CustomCell = tableView.dequeueReusableCell(for: indexPath) // Instantiate your cells
// In the cell:
extension CustomCell: ReusableCellKind { // make your subclass conform to the protocol
  open class var defaultReuseIdentifier: String { return "\(TextCell.self)" }
}

Example 2:

import CommonCell
import With
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  return with(tableView.dequeueReusableCell(indexPath: indexPath) as TextCell) {
     $0.backgroundColor = .clear
     $0.data = rowData[indexPath.row] // populate cell with data
  }
}

About

ReusableCell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published