The implementation shows an example of how you can add MetaMap SDK using a MetaMap button or MetaMap method.
In the last part, callback methods that are called when verification is successfully completed or when verifications is canceled. In order to learn whether the verification was successfully completed or cancelled we need to set a callback.

  • Start verification - showMetaMapFlow To start verification you need to use this method In order to make this work you need to set your own YOUR_CLIENT_ID and YOUR_FLOW_ID. You can find them in the Metamap Dashboard, for more details please check the Set Up An Account section.
  • Verification is completed - verificationSuccess when the verification is completed the method will be called
  • Verification is Cancelled - verificationCancelled when the verification is canceled the method will be called
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: [:])

//MARK: MetaMapButtonResultDelegate
extension ViewController: MetaMapButtonResultDelegate {

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

	func verificationCancelled() {
		print("MetaMap Verification Cancelled")
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: [:])
                    }) {
                        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 {}
 #import "ViewController.h"
    #import <MetaMapSDK/MetaMapSDK.h>

    @interface ViewController () <MetaMapButtonResultDelegate>

    @property (nonatomic, strong) MetaMapButton *metaMapButton;


    @implementation ViewController

      - (void)viewDidLoad {
          [super viewDidLoad];

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

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

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

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

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

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

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

      - (void)verificationCancelled {


In order to make this work you need to set your own CLIENT_ID and FLOW_ID. You can find them in the Metamap Dashboard, for more details please check this section.

Congratulations! At this stage, you are already able to start the Metamap SDK and have your first verification.