Skip to content

Integration via Swift Package Manager

Francisco Fortes edited this page Aug 6, 2024 · 5 revisions

Swift Package Manager integration is supported since 10.22.0 version of the Mobile Messaging SDK.

Requirements

Installation

Notice

If you previously used CocoaPods, remove pods from project pod deintegrate and integrate Notification Service Extension with SPM option

In Xcode select File->Add Packages...

Search for the Mobile Messaging Swift Package using repository's URL https://github.com/infobip/mobile-messaging-sdk-ios.git, set the Dependency Rule to Up to Next Major Version, then, select Add Package.

Notice

May be needed to add your GitHub account to the Xcode, to be able to search though repo's URLs. It can be added in Xcode->Settings->Accounts

Choose modules, which you want to add to your application.

After that, it should be possible to use all added modules in the application as usual, just by importing the module you'd like to use:

import MobileMessaging
import MobileMessagingLogging
import MobileMessagingGeofencing
import MobileMessagingInbox
import InAppChat
import WebRTCUI

This is how project looks like after adding swift package:

Notification Service Extension

For more information on Notification Service Extension and how it improves push notifications delivery check this documentation.

To integrate Notification Service Extension automatically, install latest version of mmine Ruby Gem and run integrate command with the following parameters (--spm is for adding MobileMessaging module automatically to Notification Service Extension dependencies):

$ sudo gem install mmine
$ mmine integrate \
--application-code <your Push Application Code from Infobip portal> \
--project <absolute path to your Xcode project (.xcodeproj file)> \
--app-group <your App Group Id from previous section> \
--target <name of your projects main target> \
--spm
Clone this wiki locally