For example: I have two
In macOS it's pretty easy if you are using storyboard and segues.
NSViewController has a property
presenting which contains a reference to the parent view controller.
Obtain the reference, call a method in the parent view controller to pass the data and dismiss the child view controller.
let firstViewController = presenting as! FirstViewController firstViewController.passDataBack(data) self.dismiss(self)