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?
AppDelegate *appDelegate = (AppDelegate *)[NSApp delegate];
see the docs for NSApplication for more info.
In Swift 5
let delegate = (NSApplication.shared.delegate) as! AppDelegate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With