Created
January 23, 2019 10:29
-
-
Save meyusufdemirci/ae01adc5951387aacdb44af8dfd8fc7b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class HomeTableController: UITableViewController { | |
var presenter: HomePresenterProtocol! | |
var contactList: [Contact] = [] | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
presenter.getContact() | |
} | |
} | |
extension HomeTableController: HomeViewProtocol { | |
func showContact(contact: [Contact]) { | |
self.contactList = contact | |
tableView.reloadData() | |
} | |
} | |
extension HomeTableController { | |
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return contactList.count | |
} | |
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = UITableViewCell() | |
let contact = contactList[indexPath.row] | |
cell.textLabel?.text = "\(contact.fullname) - \(contact.gsm)" | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment