# Rich push

> Add the Notification Service and Notification Content extensions for images, the long-press view and the action button.

URL: https://docs.xulo.io/ios/rich-push
iOS SDK version: 0.1.4

A text push works with the app target alone. An image and the long-press view need two extensions:

| Extension | Subclass | Does |
| --- | --- | --- |
| Notification Service | `XuloNotificationService` | Downloads the image and attaches it. Adds the action button. |
| Notification Content | `XuloNotificationViewController` | Draws the long-press view: the large image, the title, the body and a link. |

Both use the `XuloExtension` product. Neither links `Xulo`.


### Add the two extensions

In Xcode, add a Notification Service Extension target and a Notification Content Extension target to the app. Add the `XuloExtension` product to both. Set both to iOS 15 or later.

### Subclass the service

Make your subclass the extension's principal class. It can be empty.

```swift
import XuloExtension

final class NotificationService: XuloNotificationService {}
```

### Subclass the content view

```swift
import XuloExtension

final class NotificationViewController: XuloNotificationViewController {}
```

On the content extension, set `UNNotificationExtensionCategory` to `xulo`. That is the category the payload uses.

```xml
<key>NSExtensionAttributes</key>
<dict>
    <key>UNNotificationExtensionCategory</key>
    <string>xulo</string>
</dict>
```

### Share the App Group

Add the same App Group to the app and both extensions, and set `XuloAppGroup` to that group id on all three. See [Capabilities](https://docs.xulo.io/ios/capabilities).


## How images behave

- The image address must be https.
- The service extension downloads the image and attaches it.
- If the download fails, or time runs out, the text still arrives.
- The extension shares the downloaded image with the content extension through the App Group.

## The action button

A send can carry one button with an id and a text. The service extension adds it to the notification as an action.

Next: [Deep links](https://docs.xulo.io/ios/deep-links).
