Skip to content

Instantly share code, notes, and snippets.

@nalexn
Last active January 16, 2020 17:30
Show Gist options
  • Save nalexn/4e56f349f6a932320729bd4c173b80f6 to your computer and use it in GitHub Desktop.
Save nalexn/4e56f349f6a932320729bd4c173b80f6 to your computer and use it in GitHub Desktop.
protocol ListRepository {
func loadList(completion: @escaping ([Item], Error?) -> Void)
}
class ListViewController: UIViewController {
var items: [Item] = []
var tableView: UITableView?
var repository: ListRepository
override func viewDidLoad() {
repository.loadList { [weak self] (list, error) in
self?.items = list
self?.tableView?.reloadData()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment