Carousel, Slider and Thumbnail Push

Step 1: Create New Target

  1. Ensure Xcode 8 or higher is installed.

  2. In Xcode: Navigate to File > New > Target.

  1. Select Notification Content Extension.

  1. A new class named NotificationViewController will be created. Extend it from NetmeraNotificationContentExtension.

Switching Back to Debugging

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

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:

target 'your_content_extension_target_name' do
  pod "Netmera/NotificationContentExtension"
end
  1. Run pod update to apply the changes.

Step 3: Add Code to Notification Content Extension Class

  1. The new NotificationViewController class should extend NetmeraNotificationContentExtension

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

Step 4: Info.plist Configuration

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

<?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>
  1. Delete Label in MainInterface

  2. If you want to add slide action to Carousel property, UserInteractionEnabled must be set YES.

  1. 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.

  2. Specify the app group name in the app delegate method where you set the Netmera.start() method. Use the following codes as examples:

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

Last updated

Was this helpful?