---
title: NSExtensionContext.WillEnterForegroundMessage
framework: foundation
role: symbol
role_heading: Structure
path: foundation/nsextensioncontext/willenterforegroundmessage
---

# NSExtensionContext.WillEnterForegroundMessage

A message the system sends when the extension’s host app begins running in the foreground.

## Declaration

```swift
struct WillEnterForegroundMessage
```

## Overview

Overview Your extension can use this message to restart tasks that it stopped when the app moved to the background. Observe this message with the identifier willEnterForeground, or specify its type directly to the addObserver(of:for:using:) method. The Subject of this message type is NSExtensionContext. This message interoperates with the notification NSExtensionHostWillEnterForeground. The system notifies observers of the message when the NotificationCenter posts the notification. Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message for a host app entering the foreground

- [init()](foundation/nsextensioncontext/willenterforegroundmessage/init().md)

## Relationships

### Conforms To

- [NotificationCenter.MainActorMessage](foundation/notificationcenter/mainactormessage.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Working with notification messages

- [NSExtensionContext.DidBecomeActiveMessage](foundation/nsextensioncontext/didbecomeactivemessage.md)
- [NSExtensionContext.WillResignActiveMessage](foundation/nsextensioncontext/willresignactivemessage.md)
- [NSExtensionContext.DidEnterBackgroundMessage](foundation/nsextensioncontext/didenterbackgroundmessage.md)
