Hi,
I have a very simple goal: I'd like to have a data-model manage its own network fetching. It would be implemented as an object containing an array of partially-loaded objects. (Ex: MyNetworkObject.arrayOfUserObjects[0].userImage).
In use, the controller will ask the data-model for some data in the array. If the data is available, it will be immediately displayed on the view. If it is not available, the data-model will tell the controller "hold on. Let me fetch the data." The controller will then put a loading indicator on the view. When done fetching, the data-model will tell the controller "Okay here's the data" and it will be displayed on the view.
Here's my problem: I'm unsure of the best practice for telling the controller that the data-model is either currently fetching data or done fetching data. Should the data-model fully encapsulate the NSURLSession and send a NSNotifcation when done fetching? Should the controller be a delegate of the data-model be notified of changes that way? Or should the controller be the NSURLSession delegate and receive updates from the NSURLSessionTask directly?
Also, I was under the impression that delegation was reserved for communication between views and controllers. Would using a delegate between the data-model and the controller be a violation of MVC? It appears that's how NSURLSession works, so I'm a little thrown off.