tags:

views:

224

answers:

2

When working on an iPhone project, it can get really messy and many files are created (libraries, view controllers, interfaces...) What's the best way to organize your project files? What group structure do you use? Should I follow the MVC paradigm into groups?

Thanks!

A: 

We normally have a group for view controllers and custom list cells.

In our current project, we also have a group for XMLParsers (we have quite a few of those, thread-born instances to parse incoming messages from the server).

The MVC paradigm is basically moot here - of course, it is one you should follow - but I see XCode's groups as much more than just pandering to MVC in terms of filesystem layout.

Chaos
+2  A: 

Whatever makes the structure of your application most obvious is the short but ultimately unhelpful answer. I'm not sure that there's a single, correct answer.

As a one data point, here's roughly how I've structured my most complex application:

  • Application-wide data (model) has its own group
  • Utility classes/functions get their own group (sometimes nested where they require multiple classes of their own)
  • I have a UI group for simple views. These classes often also contain the controller
  • I have a bunch of other groups for series of connected views. For example, I part of my app displays tags and there are two or three views related to this. I group the views, the controllers and, sometimes, the data together

The grouping does not mirror the class structure. My general rule is that I want to have files I'll want to modify at the same time close together.

Stephen Darlington