Post marked as solved
Post marked as solved with 3 replies, 852 views
Hi all,I'm sorry if this question has already been made.I'm writing a macOS app with Swift. This App is StoryBoard based and in the main Window there is an NSView where I do some graphics.Well, in the NSViewController associated I have implemented (overriden) the@IBAction func saveDocument(_ sender: Any?)@IBAction func openDocument(_ sender: Any?)in order to save and open data associated with my NSView (accessible from the NSViewController using an Outlet).In order to call the "print" action of my NSView object, I need to connect in some way the "Print" menu item to an action. I though it would have been enough as for the "save" and "open" to override the@IBAction func printDocument(_ sender: Any?)but nothing happes: when I push CMD-P or I select "Print" from the Main Menu, is always called the standard Print Dialog (I suppose the one definited for the First Responder).If I try to connect the NSMenuItem "Print" to a normal IBAction, the Action is not discovered by XCode but the funny thing is, if in my saveDocument or openDocument I invoke the print action of my NSView, the Print Panel is opened properly and I can print my content!!Can you please help me to achieve my goal of printing my NSView?Thanks in advance!!!