Organising files and classes in XCode (iPhone application)

Posted by pulegium on Stack Overflow See other posts from Stack Overflow or by pulegium
Published on 2010-05-02T11:33:02Z Indexed on 2010/05/02 11:37 UTC
Read the original article Hit count: 207

It's a generic question and really a newbie one too, so bear with me...

I'm playing with some iPhone development, and trying to create a simple "flip type" application. Nothing sophisticated, let's say on the flip side is a short application summary, bit like 'help' and on the main screen is a simple board game, let's say tic-tac-toe or similar.

Now, XCode has generated me 'Main View', 'Flipside View' and 'Application Delegate' folders, with default template files in them.

Now the question is where do I create appropriate 'MVC' classes?

Let's say (V)iew classes are going to be the ones that have been automatically created. So the Flipside view class is responsible for generating text/images etc on the 'help' view.

'Main View' class is what draws the items on the table and updates the counters, etc.

Where should I place the 'controller' class? And also, should it only be dealing with proxying only to the model? According to this the controller method is called from the view and manipulates the method classes. Similarly, the results from model are passed back to the view class by the controller issuing the calls to appropriate view methods.

Similarly, where does the model class go? or should I just create a new folder for each, controller and model class files?

What I'm after is the best practices, or just a short description how people normally structure their applications. I know it's very specific and also undefined... I came from Django background, so the way stuff is organised there is slightly different.

Hope this makes sense, sorry if it's all bit vague, but I have to start somewhere :) And yes I've read quite few docs on the apple developer site, but trouble is that the documents are either going into too much detail about the language/framework/etc and the examples are way too simplistic. Actually, this leads me to the final question, has anyone know any good example of relatively complete application tutorial which I could use as a reference in organising my files?...

© Stack Overflow or respective owner

Related posts about xcode

Related posts about iphone