Overview
This guide shows you how to integrate the MetaMap SDK into your UIKit-based iOS application using theMetaMapButton component.
Prerequisites
- MetaMap SDK installed via CocoaPods
- iOS 13.0 or later
- Swift 5.7 or later
Implementation
Basic Setup
Here’s a complete implementation of MetaMap verification in a UIKit view controller:Key Components
1. Initialize MetaMapButton
Create an instance ofMetaMapButton in your view controller:
2. Add Button Action
Connect the button to an action handler:3. Configure Button Layout
Set the button’s frame and add it to your view:4. Set Delegate
Assign the delegate to receive verification results:5. Launch Verification Flow
In your button action handler, callshowMetaMapFlow with your credentials:
Handling Results
Implement theMetaMapButtonResultDelegate protocol to handle verification results:
Delegate Methods
verificationSuccess(identityId:verificationID:)- Called when verification completes successfullyverificationCancelled()- Called when the user cancels the verification process
Parameters
showMetaMapFlow Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
clientId | String | Yes | Your MetaMap client ID |
flowId | String | Yes | The verification flow ID |
metadata | Dictionary | No | Additional metadata and customization options |
Next Steps
- Learn about UI Customization options
- Explore SwiftUI Integration
- See Objective-C Integration