Closed amadeu01 closed 5 years ago
@tailec this implementation of the MVVM is really close to the MVP. I cannot tell the difference between this implementation and MVP.
I've added self
to delegate methods because I was following apple delegation pattern like:
func tableView(UITableView, didSelectRowAt: IndexPath)
Found some explanation there
https://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html
About MVP: I think in MVP, presenter can have access to view (imports UIKit) but view models in MVVM are forbidden to do that.
MVP just create a layer of abstraction to the view. So, the view communicate to the presenter by the protocol. But, the presenter should not have references to the UIKit. The ideia is to be able to test the view without a device (simulator). Like run the tests on macOS
I'm gonna close it
I removed the
reposViewModel
variable from:func reposViewModel(_ reposViewModel: ReposViewModel, isLoading: Bool)
func reposViewModel(_ reposViewModel: ReposViewModel, didReceiveRepos repos:)
func reposViewModel(_ reposViewModel: ReposViewModel, didSelectId id: Int)
Delegate methods