# Notifications when coming forward from the background

**URL:** <https://forums.swift.org/t/notifications-when-coming-forward-from-the-background/76996>\
**Category:** Using Swift\
**Tags:** concurrency, notification\
**Created:** [January 4, 2025, 4:45pm UTC](https://forums.swift.org/t/notifications-when-coming-forward-from-the-background/76996 "2025-01-04T16:45:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattneub](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mattneub/32/1924_2.png) [@mattneub](https://forums.swift.org/u/mattneub)\
**Post date:** [January 4, 2025, 4:45pm UTC](https://forums.swift.org/t/notifications-when-coming-forward-from-the-background/76996/1 "2025-01-04T16:45:56Z")

</div>

In iOS, I'm used to the old behavior where, if you have added yourself as an observer of some NSNotificationCenter notification, and if your app goes into the background and then later comes back into the foreground, any notifications that would have been delivered while you were in the background (but could not be, because the app is suspended in the background) _are_ delivered as you come back into the foreground.

But I find that if I switch to using the `for await` style of "subscribing" to notifications as an async stream:

```swift
    let name = // whatever
    for await _ in NotificationCenter.default.notifications(named: name) {

```

...then when we come back into the foreground, the "lost" notifications are _not_ delivered.

Not sure what my question is. Something like: Is this known? intentional? a bug? inevitable? false?

(I have to admit that I have not tested this rigorously; I'm just describing what I'm seeing for one particular notification in one particular app. So it's perfectly possible that what I'm saying is just not true in the more general case.)
