Last active
January 16, 2020 17:30
-
-
Save nalexn/4e56f349f6a932320729bd4c173b80f6 to your computer and use it in GitHub Desktop.
Article_008 https://nalexn.github.io/separation-of-concerns/
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
protocol ListRepository { | |
func loadList(completion: @escaping ([Item], Error?) -> Void) | |
} |
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 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