Created
February 2, 2019 08:43
-
-
Save bigimot22/ac45a2097cb073fc3f5eac89f81a1e59 to your computer and use it in GitHub Desktop.
Cool way to dequeue reusable Tableview cells.
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
import UIKit | |
extension UITableView { | |
func dequeueReusableCell<T: UITableViewCell>() -> T { | |
return dequeueReusableCell(withIdentifier: NSStringFromClass(T.self)) as! T | |
} | |
} | |
//To use it, you declare a cell as follow: | |
// let cell: ExampleTableViewCell = tableView.dequeueReusableCell() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment