Steps to Install your iOS Installation

Installing mmob's package allows you to unlock a world of onward journeys for your customers, all served natively within your iOS applications. mmob's library supports iOS 13+, built using Xcode 14.

To review the latest version of the SDK, see this release schedule: https://github.com/mmob-tech/mmob-client-ios/releases

Installing your iOS Integration

mmob package name is called MmobClient

To install an mmob Integration, the following steps are required:

  • Add the EF Network Client iOS package to Xcode 13 or later

  • Import MmobClient

  • Set the configuration with your organisation's cp_id and integration_id

  • Configure the customer snippet

  • Ensure you are operating off the correct instanceDomain for your region

  • You may also add locale for the user's preferred language under configuration


Step 1: Adding Swift Package Manager

To get started, add mmob's package repository in Xcode.

Step 2: Import EF Network Client Package

Add Package menu

Click File -> Add Packages

Add Package modal

In the search bar, type

https://github.com/mmob-tech/mmob-client-ios.git

You will find mmob-client-ios.

Add package confirmation

You will then see the option to Download Package - ensure that the tickbox is checked appropriately

The earliest version of MmobClient supported is v0.3.0 or above. Latest version is v0.4.0


Step 3: Point the Script to a Preconfigured Identifier

A. If you are a Distribution Partner (embedding services into your platform), your configuration will use an integration_idand cp_id and look like the following:

let configuration = MmobConfiguration(
  configuration: MmobCompanyConfiguration(
    cp_id: "Your cp_id here",
    integration_id: "Your chosen integration_id here"
  )
)

B. If you are a Service Provider (you have already created your own widget for embedding in other channels), the configuration for your distribution partner will use a distribution_id only:

let configuration = MmobDistribution(
  configuration: MmobDistributionConfiguration(
    distribution_id: "Your distribution_id here"
  )
)

Step 4: Configure the Customer Snippet with the correct parameters

Pass the following parameters into the customer snippet, using the customer's details of the customer who is actively using your application:

customer: MmobCustomerInfo(
    email: "john.smith@example.com",
    first_name: "John",
    surname: "Smith"
)
For anonymous users (users for whom you do not have a suitable GUID such as an email), do not pass in a non-unique placeholder email. Instead, ensure that the email field is left blank each time an anonymous user starts a journey.

Anonymous Users

If your organisation does not wish to pass in any data into the snippet, this part of the snippet can be left as follows:

customerInfo = MmobCustomerInfo()

For anonymous users (users for whom you do not have a suitable GUID such as an email), do not pass in a non-unique placeholder email. Instead, ensure that the email field is left blank each time an anonymous user starts a journey.

Language selection

Integrations serve content using the locale en_GB by default. In order to change language you may pass an optional locale argument:

let configuration = MmobConfiguration(
  configuration: MmobCompanyConfiguration(
    cp_id: "Your cp_id here",
    integration_id: "Your chosen integration_id here",
    locale: "ms_MY" // request content in Malay language
  )
)

Note that not all products are translated to all languages. Be sure to contact our Customer Support to request translations in the language(s) you intend to use before using the locale parameter.

Step 5: Update the Client View

func updateUIView(_ uiView: MmobClientView, context: Context) {
}

Step 6: Set your Instance Domain to Correct Region

If you are operating in the Asia Pacific region, ensure to set instanceDomain = InstanceDomain.efnetwork in return. If you do not set an instance domain, the system will default to our server in Europe.

return client.getClient(mmobConfiguration: configuration)

Example Script

On completion of these steps, your script should look like the following:

import MmobClient
import SwiftUI

struct MarketplaceView: UIViewRepresentable {
  let client = MmobClient()
  func updateUIView(_ uiView: MmobClientView, context: Context) {
    print("update UI")

  }

  func makeUIView(context: Context) -> MmobClientView {

    let configuration = MmobConfiguration(
      configuration: MmobCompanyConfiguration(
        cp_id: "Place your CP ID here",
        integration_id: "Place your Integration ID here",
        environment: "stag")

      customer: MmobCustomerInfo(
        email: "john.smith+4@example.com",
        first_name: "John",
        surname: "Smith Four",
        title: "Mr"
      )
    )

    return client.getClient(mmobConfiguration: configuration)
  }
}
`environment` should only be set to `stag` in the case that you are deploying to your UAT/Staging environment. If you are deploying to production, our system will automatically point to our production server and `environment` does not need to be specified.

Example script for anonymous users in Indonesian language

import MmobClient
import SwiftUI

struct MarketplaceView: UIViewRepresentable {
  let client = MmobClient()
  func updateUIView(_ uiView: MmobClientView, context: Context) {
    print("update UI")

  }

  func makeUIView(context: Context) -> MmobClientView {

    let configuration = MmobConfiguration(
      configuration: MmobCompanyConfiguration(
        cp_id: "Place your CP ID here",
        integration_id: "Place your Integration ID here",
        locale: "id_ID",
        environment: "stag")

      customer: MmobCustomerInfo()
    )

    return client.getClient(mmobConfiguration: configuration)
  }
}

Was this page helpful?