NSURLConnection and MVC
NSURLConnection and MVC
- Subject: NSURLConnection and MVC
- From: Koen van der Drift <email@hidden>
- Date: Wed, 19 Sep 2012 09:42:54 -0400
Briefly in my app (OSX), I download data from a database to be
displayed in a view. I created a Controller that takes care of the
NSURLConnection, retrieves the data, and sends it to a database model
class to parse. It also takes care of updating the UI during the
download ("Download in progress", "Download failed", "Downlaod is
done", etc). Once that is done, the parsed data is send back to the
controller to update the view.
I'd like to add another database class that uses a different way to
obtain the data, it only needs one pass, while the other one needs
multiple. And of course it needs to be parsed differently. Now I am
getting into trouble, because the way the controller and original
database class interact turns out to be very specific for the original
database. So I need to fix this, obviously, because there could be
more database classes in the future. Reading up on MVC and
NSURLConnection, I saw several posts on SO suggesting to put all the
NSURLConnection stuff in the database (model) class instead of the
Controller as I have been doing.
Seems like a valid solution to me, I can use notifications to keep the
controller updated about the download status.
Any thoughts?
- Koen.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden