Skip to content

Instantly share code, notes, and snippets.

@artemnovichkov
Created December 9, 2016 08:21
Show Gist options
  • Save artemnovichkov/de5bd4daf64441c724a429d1a9b1e26e to your computer and use it in GitHub Desktop.
Save artemnovichkov/de5bd4daf64441c724a429d1a9b1e26e to your computer and use it in GitHub Desktop.
UItableView dequeueing with Swift magic
import UIKit
extension UITableView {
func dequeueReusableCell<T: UITableViewCell>() -> T {
return dequeueReusableCell(withIdentifier: NSStringFromClass(T.self)) as! T
}
}
//using: let cell: ExampleTableViewCell = tableView.dequeueReusableCell()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment