Skip to content

Instantly share code, notes, and snippets.

@mildocjr
Created August 11, 2018 01:52
Show Gist options
  • Save mildocjr/14e628b3479452d753910a67eca8290f to your computer and use it in GitHub Desktop.
Save mildocjr/14e628b3479452d753910a67eca8290f to your computer and use it in GitHub Desktop.
type-cast-5
class CustomTableViewCell: UITableViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var title: UILabel!
@IBOutlet weak var subtitle: UILabel!
}
class TableView: UITableView {
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(with: identifier)
as? CustomTableViewCell
cell.imageView.image = UIImage(named: "myAwesomeImage")
cell.title.text = "My facinating title"
cell.subtitle.text = "My even better subtitle"
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment