23.4 Private Methoden in Klassenerweiterungen

Nehmen wir an, wir wollen die applicationDidFinishLaunching:-Methode des BounceAppDelegates refaktorieren. Im Moment ist alles ein wüstes Durcheinander.

Categories/Bounce3/BounceAppDelegate.m

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSSet *source = [NSSet setWithObjects:@"One",@"Two", nil];
    [source writeToFile:@"savedSet" atomically:YES];
    NSSet *fromDisk = [NSSet setWithContentsOfFile:@"savedSet"];
    NSLog(@"Set from disk: %@",fromDisk);
}

Get Cocoa-Programmierung 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.