Swift SDK Integration
This SDK is developed using the Swift programming language. We provide integration support with Swift Package Manager (SPM). You can take advantage of Swift's expressive and intuitive nature, enabling you to create sophisticated applications with ease. 🎉 We strongly recommend incorporating Swift SDK integration for incorporating Netmera into your new projects.
Quick Steps Guidelines
Step 1: Integrate SDK into Your Project
Add Netmera to your Podfile and run pod install command in your terminal.
Step 2: Setup Netmera
Import the Netmera framework in your AppDelegate.swift file and initialize Netmera in your app.
Step 3: Request Push Notification Authorization
In your pod file, add NetmeraNotification and request push notification authorization from user.
Step 4: Enable Push Notifications
Enable push notifications for your app by navigating to Signing & Capabilities > Capability > Push Notifications on Xcode.
Swift SDK integration completed 👏
Step 1: Integrate SDK into Your Project
When integrating the SDK into your project, you have two primary options: using Cocoapods or Swift Package Manager (SPM). Below are the steps for each method:
Integrating by using Cocoapods - Option 1
To integrate Netmera SDK into your project using Cocoapods, follow these steps:
Open your project's
Podfile
and add the following lines to integrate Netmera features you need:
Run
pod install
command in your terminal.
Integrating by using SPM - Option 2
To integrate Netmera SDK into your project using SPM, follow these steps:
Go to Project Settings > Package Dependencies and click the "+" button.
On the top right-hand side, enter the following link in the search bar: https://github.com/Netmera/swift-sdk and the package details will be automatically retrieved.
Lastly, click on "Add Package".
Step 2: Setup Netmera
Import the Netmera framework in your
AppDelegate.swift
file.
Initialize Netmera in your App. There are two ways to initialize Netmera.
Configuring with Netmera Plist - Option 1 (Recommended)
Add Netmera-Config.plist file to your project. Copy the following code into the Plist file and replacing the
API_KEY
placeholders with your actual API Key value.
Call Netmera initialize method in your
application(_:didFinishLaunchingWithOptions:)
method.
Configuring in App Delegate - Option 2
Add the following code to your application(_:didFinishLaunchingWithOptions:)
method, replacing the API_KEY
placeholders with your actual API Key values,
Please make sure you get the API key value from the relevant panel:
YOUR_SDK_API_KEY: You can get that api key from Developers -> API -> SDK API Key from your web panel.
Step 3: Request Push Notification Authorization
In your pod file, you should add NetmeraNotification
and install to your app target like the following.
Request push notification authorization from user by calling the following method in an appropriate place.
Essential to Inform the User:
When calling this method, it will promptly trigger the push notification permission dialog for the user. Therefore, it's essential to invoke this method after informing the user about how your application will utilize push notifications.
Important Note:
If you receive a push permission request from a push provider like Apple, it's crucial to call the appropriate method. This ensures that the Netmera SDK can correctly handle interactive push notification buttons. Failing to do so may result in these buttons not being properly managed by the SDK.
Step 4: Enable Push Notifications
Enable push notifications for your app by navigating to,
Signing & Capabilities > Capability > Push Notifications in Xcode.
Swift SDK integration completed 👍
Swift SDK integration has been successfully completed, and your devices are now ready to receive the following types of push notifications sent via the Netmera Dashboard:
Standard Push Notifications
Interactive Push Notifications (If you've configured and published them using the Dashboard)
Push Notifications with Web View Content
Push Notifications with Deeplinks
Last updated