Swiftpack.co - GetMetaMap/metamap-ios-sdk as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by GetMetaMap.
GetMetaMap/metamap-ios-sdk v2.6.1
Metamap iOS SDK https://www.getmati.com
⭐️ 8
🕓 3 weeks ago
.package(url: "https://github.com/GetMetaMap/metamap-ios-sdk.git", from: "v2.6.1")

title: "MetaMap iOS SDK" LTS version (Recommended for most users): "3.10.0" Current Version(Latest features): "3.10.1" category: 61ae8e8dba577a0010791480

MetaMap iOS Usage Guide

The following describes how to install and use the MetaMap iOS SDK for your application.

Install Using CocoaPods

  1. Create a Podfile and add the pod MetaMap-ID-SDK:
pod 'MetaMap-ID-SDK', '3.10.0'

IMPORTANT Support version SDK minimum support version is 12.0

  1. Update your pods from the terminal
pod install
  1. Add the MetaMap button to your App.

Implementation MetaMap button for Swift

import UIKit
import MetaMapSDK

class ViewController: UIViewController {

	override func viewDidLoad() {

    private func setupMetaMapButton() {

      //init button
      let metaMapButton = MetaMapButton()

      //add button action
            metaMapButton.addTarget(self, action: #selector(self.metaMapButtonAction), for: .touchUpInside)

      //set view of button
            metaMapButton.frame = CGRect(x: 20, y: self.view.frame.size.height/2 - 50, width: view.frame.size.width - 40, height: 50)

      //add button to yours view

      //set delegate to get result
      MetaMapButtonResult.shared.delegate = self


      @objc private func metaMapButtonAction() {
	//set params to showMetaMapFlow
	MetaMap.shared.showMetaMapFlow(clientId: "YOUR_CLIENT_ID",
				flowId: "YOUR_FLOW_ID",
				metadata: ["key1": "value1", "key2": 123])

//MARK: MetaMapButtonResultDelegate
extension ViewController: MetaMapButtonResultDelegate {

    func verificationSuccess(identityId: String?, verificationID: String?) {
		print("MetaMap Verification Success \(identityId)")

	func verificationCancelled() {
		print("MetaMap Verification Cancelled")

Implementation MetaMap button for SwiftUI

import SwiftUI
import MetaMapSDK
import UIKit

struct ContentView: View {
    var body: some View {
        VStack {
            ZStack {
//MARK: MetaMapDelegateObserver
                MetaMapDelegateObserver { identityId, verificationId in
                    print("\(identityId), \(verificationId)")
                } cancelled: {
                HStack {
                    Button(action: {
                        MetaMap.shared.showMetaMapFlow(clientId: "YOUR_CLIENT_ID", flowId: "YOUR_FLOW_ID", metadata: ["key1": "value1", "key2": 123])
                    }) {
                        Text("press me")

struct MetaMapDelegateObserver: UIViewControllerRepresentable {
    let vc = MatiViewController()
    public func makeUIViewController(context: Context) -> MatiViewController {
        return vc
    public func updateUIViewController(_ uiViewController: MatiViewController, context: Context) {}
    var success: (_ identityId: String?, _ verificationId: String?) -> Void
    var cancelled: () -> Void
    public func makeCoordinator() -> Coordinator {
        Coordinator(success: success, cancelled: cancelled)
    public  class Coordinator: NSObject, MetaMapButtonResultDelegate {
        public  func verificationSuccess(identityId: String?, verificationID: String?) {
            success(identityId, verificationID)
        public  func verificationCancelled() {
        var success: (_ identityId: String?, _ verificationId: String?) -> Void
        var cancelled: () -> Void
        init(success: @escaping (_ identityId: String?, _ verificationId: String?) -> Void, cancelled: @escaping () -> Void) {
            self.success = success
            self.cancelled = cancelled
            MetaMapButtonResult.shared.delegate = self

class MetaMapViewController: UIViewController {}

Implementation MetaMap button for Objective-C

    #import "ViewController.h"
    #import <MetaMapSDK/MetaMapSDK.h>

    @interface ViewController () <MetaMapButtonResultDelegate>

    @property (nonatomic, strong) MetaMapButton *metaMapButton;


    @implementation ViewController

      - (void)viewDidLoad {
          [super viewDidLoad];

          //init button
          self.metaMapButton = [[MetaMapButton alloc] init];

          //add action to yours button
            [self.metaMapButton addTarget:self action:@selector(metaMapButtonAction:) forControlEvents:UIControlEventTouchUpInside];

          //set view of button
          self.metaMapButton.frame = CGRectMake(20, self.view.frame.size.height/2 - 25, self.view.frame.size.width - 40, 50);
          self.metaMapButton.center = self.view.center;

           //add button to yours view
          [self.view addSubview:self.metaMapButton];

          //set delegate to get result
          [MetaMapButtonResult shared].delegate = self;

      //add showMetaMapFlow function with YOURS parameters
      -(void)metaMapButtonAction:(UIButton *) sender{
          [MetaMap.shared showMetaMapFlowWithClientId:@"YOUR_CLIENT_ID" flowId:@"YOUR_FLOW_ID"  metadata:@{@"key1":@"value"}];

    #pragma mark - MetaMapButtonResultDelegate
      -(void)verificationSuccessWithIdentityId:(NSString *)identityId, verificationID(NSString *) {
          NSLog(@"Success: [email protected]", identityId);

      - (void)verificationCancelled {


IMPORTANT Info.plist 4. Add the following permissions to capture video, access the photo gallery, access the microphone and access to the location

<string>MetaMap needs access to your Camera</string>
<string>MetaMap needs access to your media library</string>
<string>MetaMap needs access to your Microphone</string>
<string>MetaMap will use your location information to provide best possible verification experience.</string>
<string>MetaMap will use your location information to provide best possible verification experience.</string>
<string>MetaMap will use your location information to provide best possible verification experience.</string>

Metadata is an additional optional parameter:

Set the Language:

metadata: ["fixedLanguage": "es"]

Set the Button Color:

metadata: ["buttonColor": "hexColor"]

Set the Title color of the button:

metadata: ["buttonTextColor": "hexColor"]

Set identity Id as parameter for re-verification:

metadata: ["identityId": "value"]


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

Release Notes

2 weeks ago
  • fixed issue on the CPF screen
  • fixed issue on the selfie photo screen
  • fixed verifications completed status for Brazilian Driving License verification
  • corrected text/Title on the Main screen
  • support dark mode
  • support country restriction enable mode

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