Swiftpack.co - mmob-tech/mmob-client-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mmob-tech.
mmob-tech/mmob-client-ios v0.4.0
MMOB iOS Snippet
⭐️ 0
🕓 1 week ago
iOS
.package(url: "https://github.com/mmob-tech/mmob-client-ios.git", from: "v0.4.0")

MMOB iOS Client 📱

The MMOB iOS Client works across multiple iOS versions from iOS 12.0 to iOS 16.*

Instructions to implement

MmobViewController.swift

//
//  MmobViewController.swift
//

import MmobClient
import UIKit
import WebKit

class MmobViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
    var webView: MmobClientView!
    let client = MmobClient()

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func loadView() {
        super.loadView()
        view = getMarketplace()
    }

    func getMarketplace() -> MmobClientView {
        let configuration = MmobIntegration(
            configuration: MmobIntegrationConfiguration(
                cp_id: "YOUR_CP_ID_HERE",
                integration_id: "YOUR_CP_DEPLOYMENT_ID_HERE",
            ),
            customer: MmobCustomerInfo(
                email: "[email protected]",
                first_name: "John",
                surname: "Smith",
                title: "Mr",
                building_number: "Flat 81",
                address_1: "Marconi Square",
                town_city: "Chelmsford",
                postcode: "CM1 1XX"
            )
        )

        return client.loadIntegration(mmobConfiguration: configuration)
    }
}

Instructions to implement using SwiftUI

If you plan on using our client through the SwiftUI framework you will need to follow some extra steps. Once you have created the above MmobViewController.swift file follow below

MmobView.swift

//
//  MmobView.swift
//

import SwiftUI

struct MmobView: UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> MmobViewController {
        return MmobViewController()
    }

    func updateUIViewController(_ uiViewController: MmobViewController, context: Context) {
        // Updates the state of the specified view controller with new information from SwiftUI.
    }
}

ContentView.swift

//
//  ContentView.swift
//

import SwiftUI

struct ContentView: View {
    var body: some View {
        MmobView()
    }
}

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v0.4.0
1 week ago

🚀 Enhancements

  • Adds MMOB In-App Browser support
  • Instance domain is now an enum with the following values: MMOB, EFNETWORK

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics