Re: Examples of MVC pattern with Core Data
Re: Examples of MVC pattern with Core Data
- Subject: Re: Examples of MVC pattern with Core Data
- From: "I. Savant" <email@hidden>
- Date: Wed, 14 Oct 2009 11:37:04 -0400
On Oct 14, 2009, at 11:29 AM, Kyle Sluder wrote:
On Oct 14, 2009, at 7:03 AM, Darren Wheatley <email@hidden
> wrote:
I've been Googling and searching the XCode docs for good examples
of using the MVC pattern with Core Data, but not had a lot of
success.
Because MVC is so pervasive throughout Cocoa, its use is rarely
called out except in introductory documentation. Almost every Core
Data application sample you find is going to employ an MVC
architecture, if for no other reason than that's what AppKit is
designed for.
Indeed the most basic example (creating a new, plain Core Data
application - non-document-based) is almost a perfect, complete
example. Just add a "Person" entity with the usual attributes, then
(is it option-drag, command-drag, control-drag?) drag the entity into
the main window of your nib and let it create the basic interface
needed for managing "Person" objects.
Make sure it works as expected and there you have a complete
example. The model (your Managed Object Model), the view (your window,
table, fetch button, search bar, etc.), and the controller (the
NSArrayController added when the UI was auto-generated) are all
represented in a rather clean demonstration.
Of course there are other things about this basic setup that
represent all three of these layers, but asking "what are they" is far
too broad a question. You'll just have to study the Cocoa frameworks
to identify them.
As other recent threads highlight, there's room for flexibility in
both interpretation of the MVC "rules" and the implementation of your
application's ultimate design.
--
I.S.
_______________________________________________
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