In iOS to get the delegate I use following code:
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication] delegate];
How to get the delegate in Cocoa Mac programming?