What is the best way to organize the source code of a large Cocoa application in Xcode?

Here is what I am looking for:

I would like to divide the parts of the functionality into some modules or components in order to limit the visibility of other classes, so that each class has access to all other classes, which eventually lead to spaghetti code.

In Java and Eclipse, for example, I will use packages and put each package in a separate project with a well-defined dependency structure.

Things I reviewed:

  • Using separate folders for source files and using groups in Xcode :
    • Pros: easy to use, virtually no Xcode configuration required
    • Cons: lack of separation of time for compilation, i.e. access to everything is just one operator #import.
  • Using frameworks :
    • Pros: Framework code cannot access access classes outside the scope. This provides encapsulation and keeps things separate.
    • Cons: Managing codes is cumbersome if you are working with multiple Framework at the same time. Each Framework is a separate Xcode project with a separate window.
  • Using plugins :
    • Pros: Like Frameworks, the plugin code cannot access the code of other plugins. Pure separation at compile time. A plugin source can be part of the same Xcode project.
    • Cons: Not sure. It could be the way ...

, , , ?

Edit:

  • Mac OS X
  • .
  • Cocoa (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/Concepts/Plugins.html)
+5
4

Mac ( > 2M SLOC 90 xcodeproj), :

  • , Frameworks, Bundles dylib, . , , , . , iOS, . , , . , "" . , , .

  • - , . , C/++ , . ", , " ( ). . , .

  • xcodeproj. , "". 90- . . (Xcode 4 , , - Xcode 4, , , .)

  • . , Framework. . include .

  • . include . , . , , , , . .

  • xcconfig, . . , , :


common="../../common"
foo="$(common)/foo"
HEADER_SEARCH_PATHS = $(inherited) $(foo)/include

  • . common/foo/include/foo/foo.h. , . : #import <foo/foo.h>. . . .

  • Xcode 4, Xcode 3 , ".a" , , , . Xcode 4, , .

  • ( -L -L ). , . , LD_FLAGS. . . libssl.a , -L , -lssl. , libssl.a , libssl.so. -L, -L, . ( .) xcconfig:


LD_FLAGS = "$(openssl)/lib/libssl.a"

  • , , ( , ), Framework , , ( ), . , , IMO. , .
+9

:

  • Framework. , , , , .

  • Framework. , . , .

  • XCode4 ( ). ( , Eclipse), . , Frameworks.

iOS, , , , , .

+4

, ( ), Model-View-Control (MVC), ( , git).

, :

"" , ( , "" ) Objective-C 1, NSObject "model", NSObject. Objective-C 1.0 , , , "" - Objective-C 2.0.

XIB XIB , ( Xode 3 Xcode 4). Apple, Cocoa Touch API , /, Apple API.

, / (, XIB) .

, ( ) , "", .

, , .

+2

.

"" - , , , . , , , , / XCode .

huuge , . , , , framework/extra . , , , .

. ( , - , ) - ? , , , ( - ). (), / , , .

. ... , , /.

0

All Articles