# Custom replacements

To use the custom replacements function yoou will need to update the notification extension cerated in the previous step, here are the steps to follow.

## 1. Create an app group identifier

Go to developer.apple.com -> Certificates, Identifiers & Profiles -> Identifiers. Select App Groups and create a new one.

![](/files/vXeqJzm53DGwbrtDSrKJ)

## 2. Enable App Groups&#x20;

You will need then to enable app groups, with the app group created previously, both on developer.apple.com and on the project in XCode, under the Signing & Capabilities section.

You need to do this for the main app and for the notification extension.

## 3. Set the app group identifier

In your `AppDelegate` class set the app group identifier

```swift
SwiftMpushPlugin.appGroupIdentifier = "YOUR_APP_GROUP_ID"
```

## 4. Update the notification extension code

Update your notification extension code to manage the replacements

```swift
    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        self.contentHandler = contentHandler
        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
        
        if let bestAttemptContent = bestAttemptContent {
            manageCustomReplacements(request: request, bestAttemptContent: bestAttemptContent)
            ...
        }
    }

    private func manageCustomReplacements(request: UNNotificationRequest, bestAttemptContent: UNMutableNotificationContent) {
        let appGroupIdentifier = "YOUR_APP_GROUP_ID"
        let customDatakey = "com.mumble.mpush.customData"
        guard let customData = UserDefaults(suiteName: appGroupIdentifier)?.object(forKey: customDatakey) as? [String: String] else {
            return
        }
        
        for (key, value) in customData {
            bestAttemptContent.title = request.content.title.replacingOccurrences(of: key, with: value)
            bestAttemptContent.body = request.content.body.replacingOccurrences(of: key, with: value)
        }
    }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mpush.cloud/flutter-sdk/ios-setup/custom-replacements.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
