Trigger Event from one View Controller to another

I have a macOS app using IB/Xcode 11 with two View Controllers with each having their own custom class. The first controller contains a tableview of my datasource. The second view controller has a detail view to insert new data as in an add function.

So, I would like to have an event in the first controller that gets control when the second controller inserts the new data to my SQLite table.

How is this done?
first controller that gets control when the second controller inserts the new data to my SQLite table.
What do you want exactly by "getting control" ?
If you have first VC subscribe to a notification and post it when you add, that should normally do the trick. And then, in the handling of the notification by first VC, you should update the table and make the window key and front (with makeKeyAndOrderFront).
Yes I want the two VCs to communicate with each other. I have been looking for examples of this as well as more information on how this is coded. I saw one old video on this subject but it seems to have changed as to the way this can be done.

So, I have started with the following code:

NSUserNotificationCenter.default.addObserver(observer: NSObject, forKeyPath: String, options: NSKeyValueObservingOptions>, context: UnsafeMutableRawPointer)

but not sure if this is what you are talking about as well as what to code for the arguments. Would you mind a little more detail how this is done?

Thanks
It seems there are several ways to communicate from one VC to another. So, I looked at a couple. One using Key Value Observation and another using a notification in @objc. So, I used the @objc route as it was more straight forward for what I needed. It goes something like the following
Register
Code Block
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(userLoggedIn), name: Notification.Name("UserLoggedIn"), object: nil)

Post
Code Block
nc.post(name: Notification.Name("UserLoggedIn"), object: nil)

Then an @objc func userLoggedIn to handle the action of the post.

At any rate I have this working.
Thanks
Yes, that is the usual notification mechanism I was referring to

Code Block
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(userLoggedIn), name: Notification.Name("UserLoggedIn"), object: nil)


Good to see but no surprise it solved your problem.
Trigger Event from one View Controller to another
 
 
Q