In the application there are notifications with firebase from where id and obj_type . This is in order to open a section for example (news, analytics, etc.) and transmit id news to open news by id . This is all I process in AppDelegate and from there I put the rutovsky ViewController . The problem is that if the user opened the notification when the application was closed, I need to open the ViewController . And if the user opened the notification when the application was already open, then for example, you need to open ViewController2 . The transitions are ready for me, the problem with the logic, you need to somehow track the application opened from scratch or have already been launched in order to make the appropriate transitions.
What I tried:
extension UIApplication { class func isFirstLaunch() -> Bool { if UserDefaults.standard.bool(forKey: "hasBeenLaunchedBeforeFlag") { UserDefaults.standard.set(true, forKey: "hasBeenLaunchedBeforeFlag") UserDefaults.standard.synchronize() return true } return false } } But unfortunately it did not help.