
558 9 Chapter 27: Writing and Using Services
@interface DiaryService 9 NS0bject {
DiaryDocument* theDiary;
}
- (void) init;
- (void) newDiaryEntryForService.
(NSPasteboard *) pboard
userData- (NSString *)data
error. (NSString **)error;
@end
You create an instance of this class and then install it as a ser-
vice as soon as your application starts up. In the Diary appli-
cation, the service class is called DiaryService. Here is the
instantiation and installation code. Because it needs the refer-
ence to DiaryDocument, it is located at the end of the con-
structor for DiaryDocument in Diary.
Java"
DiaryService theService ...