Created
July 21, 2017 22:29
-
-
Save efremidze/1ba21c1eeb97381e41455e68641da2ec to your computer and use it in GitHub Desktop.
UITableView reusable cell block
This file contains hidden or 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 reusableCell(style: UITableViewCellStyle, reuseIdentifier: String, configureBlock: ((UITableViewCell) -> Void)? = nil) -> UITableViewCell { | |
if let cell = dequeueReusableCell(withIdentifier: reuseIdentifier) { | |
configureBlock?(cell) | |
return cell | |
} | |
return UITableViewCell(style: style, reuseIdentifier: reuseIdentifier) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment