Created
November 21, 2016 15:11
-
-
Save thiagolioy/2ad7d5d6ca89311081ab5805b8c354ea to your computer and use it in GitHub Desktop.
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 | |
protocol ItemsTableViewDatasource: UITableViewDataSource { | |
associatedtype T | |
var items:[T] {get} | |
weak var tableView: UITableView? {get} | |
weak var delegate: UITableViewDelegate? {get} | |
init(items: [T], tableView: UITableView, delegate: UITableViewDelegate) | |
func setupTableView() | |
} | |
extension ItemsTableViewDatasource { | |
func setupTableView() { | |
self.tableView?.dataSource = self | |
self.tableView?.delegate = self.delegate | |
self.tableView?.reloadData() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment