Search code examples
objective-cxcodemodel-view-controllerproject-organization

What's the case for putting NIBs in the Resources/ project group?


I've seen this several times in blog posts and apple sample projects. Where all the NIB files are placed somewhere in the resources directory.

It doesn't make that much sense to me. Usually when I use nibs (which is rare) they are closely tied to a specific UIViewController which would be located in the Classes/ directory.

So I usually group each nib with it's corresponding viewcontroller's .h and .m files.

The only case I could see for putting a Nib in the resources directory is that if it were a reusable resource that gets accessed by multiple view controllers. Though that always seemed like way more trouble than it was worth.

Can someone explain the rational here?


Solution

  • As far as I understand NIBs were put to resources dir in Xcode 3 schema, when Interface builder was rarely used, and NIBs were some kind of resources that were separated from the code. In Xcode 4 when you create View Controller for example you can tell IDE to generate XIB file fore it and they are put by default in the same dir as source files.