swift - How do I programmatically save an NSDocument? -
i need programmatically save active document of nsdocument based app within method of nsviewcontroller controls document view. menu items sending save() first responder. best way programmatically? should a) reference nsdocument (somehow) , call save method or b) send save: message first responder?
i'd (b) easiest do. have call line nsresponder
down chain (like view controller):
nsapp.sendaction(#selector(nsdocument.save(_:)), to: nil, from: self)
this have same effect choosing "save" menu bar.
Comments
Post a Comment