A. Source Code

Chapter 3—RadarWatcher

AppController.h

#import <Cocoa/Cocoa.h>@class PreferenceController;@interface AppController : NSObject{    PreferenceController *preferenceController;}- (IBAction)showPreferencePanel:(id)sender;@end

AppController.m

#import "AppController.h"#import "PreferenceController.h"@implementation AppController+ (void)initialize{    // Create the user defaults dictionary    NSUserDefaults *defaults;    defaults = [NSUserDefaults standardUserDefaults];    if ([defaults integerForKey:pkeyInitialized] == 0) {        // Save our defaults if not already initialized        [defaults setObject:[NSNumber numberWithInt:1] forKey:pkeyInitialized];        [defaults setObject:[NSNumber numberWithInt:NSOnState]            forKey:pkeyOpenNewWindow]; ...

Get Mac OS® X Advanced Development Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.