Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! TableViewCell
- cell.title.text = "Some text"
- // config other data...
- return cell
- }
- protocol SomeCellProtocol {
- func setTitle(text: String)
- }
- class SomeCell: UITableViewCell {
- @IBOutlet weak var title: UILabel!
- }
- extension SomeCell: SomeCellProtocol {
- func setTitle(text: String) {
- title.text = text
- }
- }
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! TableViewCell
- cell.setTitle(text: "Some text")
- // config other data...
- }
Add Comment
Please, Sign In to add comment