Search code examples
cocoamacoscocoa-design-patterns

Cocoa Application Bootstrap Questions


I am an experienced developer, new to Mac development, so I

There are still lots of gaps, and I'm having a hard time finding good readables. Some of my questions are listed below. These are very simple/general. There must be a short, concise doc that details the basic app bootstraping process, and all involved classes. Thanks!

  • The "delegate" that gets generated by XCode contains instances of NSPersistentStoreCoordinator, NSManagedObjectModel, and NSManagedObjectContext -- details please?
  • The delegate is declared "@interface tests_AppDelegate : NSObject {" . Why is the protocol missing? I see examples on the net with it there.
  • I see that the application delegate is instantiated inside Interface Builder. Where is it passed into the NSApplication instance?

Solution

  • The "delegate" that gets generated by XCode contains instances of NSPersistentStoreCoordinator, NSManagedObjectModel, and NSManagedObjectContext -- details please?

    That's Core Data stuff.

    The delegate is declared "@interface tests_AppDelegate : NSObject {" . Why is the protocol missing? I see examples on the net with it there.

    Probably an oversight. AppKit didn't always have a formal NSApplicationDelegate protocol. It's possible that Apple simply never updated the templates. You might file a bug.

    I see that the application delegate is instantiated inside Interface Builder. Where is it passed into the NSApplication instance?

    Right-click on the application object. You'll find that its delegate outlet is connected to the delegate object.