Prerequisites
Before starting, ensure you have:
- Completed the Installation guide
- Your MetaMap Client ID from the dashboard
- Your Flow ID for the verification flow you want to use
- Required permissions configured in
Info.plist
Implementation Steps
1
Import MetaMap SDK
Open your
ViewController.swift file and import the MetaMap SDK:ViewController.swift
2
Setup MetaMap Button
Create and configure the MetaMap button in your view controller. Add this code to your
ViewController class:ViewController.swift
The
MetaMapButton comes with default MetaMap branding. You can customize its appearance using metadata (see Customization below).3
Launch Verification Flow
Add the action handler that launches the MetaMap verification flow when the button is tapped:
ViewController.swift
4
Handle Verification Results
Implement the
MetaMapButtonResultDelegate to handle verification callbacks:ViewController.swift
Complete Example
Here’s the complete working implementation:ViewController.swift
Customization
Themetadata parameter allows you to customize the SDK behavior and appearance:
Set Language
By default, the SDK uses English. You can set a fixed language:Supported languages:
en, es, fr, pt, ru, tr, de, it, pl, thCustomize Button Colors
Customize the button appearance to match your app’s design:Re-verification Flow
For returning users, pass their existing identity ID:Enable Encryption
For enhanced security, use an encryption configuration:Custom Fonts
Use your app’s custom fonts (ensure font files are included in your project):Testing Your Integration
1
Build and Run
Build and run your app on a physical iOS device (camera access is limited in simulator):
2
Grant Permissions
When prompted, allow camera, photo library, and microphone access.
3
Complete Verification
Tap the MetaMap button and complete the verification flow:
- Follow the on-screen instructions
- Capture required documents
- Complete liveness check
- Confirm submission
4
Check Results
Verify that your delegate methods are called:
- Check console logs for success/cancellation messages
- Verify you receive
identityIdandverificationID
Common Metadata Options
Here’s a comprehensive example with multiple metadata options:Next Steps
SwiftUI Integration
Learn how to integrate with SwiftUI
Advanced Configuration
Explore advanced SDK configuration options
Handle Results
Learn how to process verification results
API Reference
View complete API documentation