Application not terminating after processing a notification action

Using the following function:

userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void ) 

I am utilizing the response to process a notification with an action and I am running into some odd behavior when the application is fully killed prior. Following all of the work that needs to be completed related to the action, I make sure to call the completionHandler at the right time. This works as expected, but I am trying to understand why does the application continue to run?

While the application may not show as running after the work is completed and completionHandler() is called, it is evident that it is still running as when I go to open it, it picks back up from my dashboard screen and has all the data already loaded. Since the app was killed prior to performing the notification action, I expect the app to be killed/terminated after calling completionHandler(). This way after opening it up normally, it should start from the beginning. Why does the app continue to run in this case?

Since the app was killed prior to performing the notification action, I expect the app to be killed/terminated after calling completionHandler().

Why do you expect that? Nothing in the documentation (either for notifications or for the other things that launch an app into the background) actually says that.

The OS keeps its own counsel about when to kill background apps. Maybe your app got killed earlier due to memory pressure, but now after handling the notification response there happens to be less memory pressure. Or maybe the OS figures the user may want to resume your app soon and keeps it around a little longer. Or maybe it prioritizes background apps alphabetically according to height. It doesn’t really matter because you can’t do anything about it. Just make sure your app behaves correctly in all cases.

Application not terminating after processing a notification action
 
 
Q