# Carousel, Slider and Thumbnail Push

{% hint style="danger" %}
**Warning:**

You should build your application with **Xcode 8 or higher** to use iOS10 media push on your application.&#x20;
{% endhint %}

## Step 1: Create New Target

1. **Ensure** Xcode 8 or higher is installed.
2. **In Xcode**: Navigate to **File > New > Target**.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FOAcboRdAqf5WIluDLDOQ%2Fimage.png?alt=media&#x26;token=9d6d8bc2-db97-4e33-95a4-424ab4c0b10c" alt="" width="563"><figcaption></figcaption></figure>

3. Select **Notification Content Extension**.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2F6SJkiYL5b0eTpE5FJ8hD%2Funnamed.png?alt=media&#x26;token=dab6ea41-3d5d-4d48-84a6-a4cb98f666ec" alt="" width="563"><figcaption></figcaption></figure>

4. A new class named **NotificationViewController** will be created. **Extend** it from `NetmeraNotificationContentExtension`.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FXTlXL1o3K68E9u2jpMrn%2FUntitled%20(1).png?alt=media&#x26;token=86b11de0-f431-4272-b9d6-c96b8b1900b3" alt="" width="259"><figcaption></figcaption></figure>

{% hint style="info" %}
**Switching Back to Debugging**

If you accidentally "Activate", you can return to debugging your app using Xcode, which is located alongside the play button.
{% endhint %}

## Step 2: Add your Project to Pod File

1. **Remove** the Objective-C Bridging Header file.
2. Add `NetmeraNotificationContentExtension` in the NotificationContent.swift file.
3. In your **Podfile**, add:

```ruby
target 'your_content_extension_target_name' do
  pod "Netmera/NotificationContentExtension"
end
```

4. **Run `pod update`** to apply the changes.

{% hint style="danger" %}
**Warning**: Run `pod update` after editing the Podfile.
{% endhint %}

## Step 3: Add Code to Notification Content Extension Class

1. The new **NotificationViewController** class should extend `NetmeraNotificationContentExtension`

{% tabs %}
{% tab title="Swift" %}

```
class NotificationViewController: NetmeraNotificationContentExtension {
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any required interface initialization here.
    }
}
```

{% endtab %}

{% tab title="Objective-C" %}

```java
#import <UIKit/UIKit.h>
#import <NetmeraNotificationContentExtension/NetmeraNotificationContentExtension.h>

@interface NotificationViewController : NetmeraNotificationContentExtension

@end
```

```
#import "NotificationViewController.h"
#import <UserNotifications/UserNotifications.h>
#import <UserNotificationsUI/UserNotificationsUI.h>

@interface NotificationViewController ()

@end

@implementation NotificationViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  // If you want to change the background color, uncomment the next line
  // self.view.backgroundColor = [UIColor whiteColor];
}

@end
```

{% endtab %}
{% endtabs %}

## Step 4: Info.plist Configuration

1. Make sure the **info.plist** file under the content extension looks like this.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2F8g99V0qm3Kmo9D37w7Wl%2FScreenshot%202023-10-10%20at%2016.36.09.png?alt=media&#x26;token=6468cbcb-8370-490b-af26-5b6f141b0811" alt=""><figcaption></figcaption></figure>

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AppGroupName</key> <string>your group name</string>

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>UNNotificationExtensionCategory</key>
            <array>
                <string>NetmeraGeneral</string>
                <string>NetmeraCarousel</string>
            </array>
            <key>UNNotificationExtensionInitialContentSizeRatio</key>
            <integer>1</integer>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.usernotifications.content-extension</string>
    </dict>
</dict>
</plist>
```

2. Delete **Label** in `MainInterface`
3. If you want to add slide action to Carousel property, `UserInteractionEnabled` must be set **`YES`**.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FIAt8On4wGJjabnH5cyTe%2Fimage.png?alt=media&#x26;token=b6830052-9e7b-44ae-ac06-929bdb37b573" alt=""><figcaption></figcaption></figure>

4. Enable App Groups for both your application and the NotificationContent extension in the Capabilities settings of your project. Then add "**group.com.yourcompany.carousel**" to your app groups.
5. Specify the app group name in the app delegate method where you set the **`Netmera.start()`** method. Use the following codes as examples:

{% tabs %}
{% tab title="Swift" %}

```swift
Netmera.setAppGroupName = "group.com.yourcompany.carousel"
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
[Netmera setAppGroupName:@"group.com.yourcompany.carousel"];
```

{% endtab %}
{% endtabs %}
