I am following tutorial from raywanderlich site to implement singleton and facade design pattern from this link. http://ift.tt/2uhOnwy In the tutorial, they hardcoded album data inside init() of the PersistencyManager class. However, in my case I need to call http request to get the data. So the problem now is when the libraryAPI (singleton) create PersistencyManger instance, the init() gonna take few times to fetch the data. So, when my viewcontroller want to call libraryAPI.getAlbum(), it's gonna be empty. Also I still need to reload data for my viewcontroller. So what's the best way to implement facade design pattern with http request?
Aucun commentaire:
Enregistrer un commentaire