How to pass model object from view controller to app delegate? iOS Swift

Hello!

I'm trying to handle actions on local notification's responses from users in AppDelegate(like I learned in Data Collections Book by Apple) My model object is in view controller. But I need to access it from AppDelegate. What approaches on this?

Did you try to use notification with user payload ? And have AppDelegate subscribe to this notification in didFinishLaunching?

        NotificationCenter.default.addObserver(self, selector: #selector(someFunc(_:)), name: Notification.Name("someNotification"), object: nil)  

    @objc func someFunc(_ sender: Notification) {
    }

No, I didn't. I'm newbie) Thanks for response. I'll try.

How to pass model object from view controller to app delegate? iOS Swift
 
 
Q