I'm trying to figure out in MVVM and MVP architecture designs. I've decided to write simple one screen application with different design approaches.
Few words about sample application:
- It's a simple image loader
- Flow: Loads JSON with pictures from 500px -> Shows cells in
UICollectionView
depends on count pictures in returned JSON -> Gradually downloads pictures and displays it in cells - The same applications I'm implementing under 3 architecture designs
MVVM
,MVC
andMVP
Everything was going smoothly until I've needed to download images and display them đ .
Initially I've though that the best place for handling this logic and caching pictures is ViewModel
(from MVVM
) and in Presenter
(from MVP
) but AFAIK these two entities should be independent from UI layer, but if we want to use UIImage
there it means that we should import UIKit
in ViewModel
/Presenter
đ€
So, questions
- Can I use
import UIKit
inViewModel
/Presenter
? - What is the best place for Load&Store
UIImage
in thisUIViewController
,ViewModel
/Presenter
or something else?
GitHub link on sample application
Aucun commentaire:
Enregistrer un commentaire