Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the old way to dequeue cell without path #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Sources/View/UITableView+Reusable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ public extension UITableView {
}
return cell
}


/**
Returns a reusable `UITableViewCell` object for the class inferred by the return-type

- parameter cellType: The cell class to dequeue
- returns: A `Reusable`, `UITableViewCell` instance

- note: It's the old way to dequeueCell and it's used when you insert cell at the end of tableview.
- seealso: `dequeueReusableCell(withIdentifier:)`
*/
final func dequeueReusableCell<T: UITableViewCell>(cellType: T.Type = T.self) -> T where T: Reusable {
guard let cell = self.dequeueReusableCell(withIdentifier: cellType.reuseIdentifier) as? T else {
fatalError(
"Failed to dequeue a cell with identifier \(cellType.reuseIdentifier) matching type \(cellType.self). "
+ "Check that the reuseIdentifier is set properly in your XIB/Storyboard "
+ "and that you registered the cell beforehand"
)
}
return cell
}



/**
Register a NIB-Based `UITableViewHeaderFooterView` subclass (conforming to `NibReusable`)
Expand Down