Last active
August 1, 2021 18:15
-
-
Save hmlongco/09b0cb837b7ef6389ee0feb2c623592a to your computer and use it in GitHub Desktop.
The tableview extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UITableView { | |
func dequeueCell<Cell:UITableViewCell>(_ id: String, for indexPath: IndexPath, configure: (_ cell: Cell) -> Void) -> UITableViewCell { | |
let cell = dequeueReusableCell(withIdentifier: id, for: indexPath) | |
if let cell = cell as? Cell { | |
configure(cell) | |
} | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment