Global point of view
An UIViewController is here to Control a View. It means interactions (give good data to the view, and answer to view interactions).
A model / an entity can be created by independents sources (unless the source itself is semantically linked with your model). A Photo is a Photo, whatever if created from a data retrieved from a server or from a local Camera Roll picture.
You should use a custom DataFetcherController to get a remote data and transform it into a instance.
Example Flow
Your UIViewController subclass
needs a list of photos. It asks the PhotoServerFetcherController
for getting the data from the Server. The fetcher can look into its cache and perfom a request the a server if needed. When the PhotoServerFetcherController
get the data and parse it to instances of your Photo
entity and give it back to the UIViewController`.
Data fetcher interactions
The best is to create your own FetcherController
interface (@protocol
keyword). You can handle 2 async callbacks : success
with the data in it and failure
with the error in it (connection ? bad input ?).
Here you have many ways to implements that, the main 2 patterns for 1 to 1 interactions are delegate
or block callbacks
.