Skip to main content

Overview

The MetaMap SDK provides several customization options through the metadata parameter in the showMetaMapFlow method. You can customize button colors, fonts, language, and more.

Metadata Parameter

All customization options are passed as key-value pairs in the metadata dictionary:
MetaMap.shared.showMetaMapFlow(
    clientId: "YOUR_CLIENT_ID",
    flowId: "YOUR_FLOW_ID",
    metadata: [
        "buttonColor": "#FF5733",
        "buttonTextColor": "#FFFFFF",
        "fixedLanguage": "es",
        "regularFont": "Roboto-Regular.ttf",
        "boldFont": "Roboto-Bold.ttf"
    ]
)

Color Customization

Button Color

Customize the main button background color using hex color format:
metadata: ["buttonColor": "#FF5733"]
Default: White (#FFFFFF) Format: Hex color code (e.g., #FF5733, #00A86B)

Button Text Color

Customize the button title color using hex color format:
metadata: ["buttonTextColor": "#FFFFFF"]
Default: Black (#000000) Format: Hex color code (e.g., #FFFFFF, #333333)

Example: Complete Color Customization

// Blue button with white text
MetaMap.shared.showMetaMapFlow(
    clientId: "YOUR_CLIENT_ID",
    flowId: "YOUR_FLOW_ID",
    metadata: [
        "buttonColor": "#007AFF",
        "buttonTextColor": "#FFFFFF"
    ]
)

Language Customization

Fixed Language

Set a specific language for the SDK interface:
metadata: ["fixedLanguage": "es"]
Default: English ("en") Supported Languages:
CodeLanguage
enEnglish
esSpanish
frFrench
ptPortuguese
ruRussian
trTurkish
deGerman
itItalian
plPolish
thThai

Example: Spanish Interface

MetaMap.shared.showMetaMapFlow(
    clientId: "YOUR_CLIENT_ID",
    flowId: "YOUR_FLOW_ID",
    metadata: ["fixedLanguage": "es"]
)

Font Customization

Custom Fonts

You can customize both regular and bold fonts used throughout the SDK interface:
metadata: [
    "regularFont": "REGULAR_FONT_NAME.ttf",
    "boldFont": "BOLD_FONT_NAME.ttf"
]
Important: Your project must include these font files, otherwise the SDK will use default system fonts.

Adding Custom Fonts to Your Project

  1. Add the .ttf or .otf font files to your Xcode project
  2. Ensure the fonts are included in your app target
  3. Add the font names to your Info.plist:
<key>UIAppFonts</key>
<array>
    <string>Roboto-Regular.ttf</string>
    <string>Roboto-Bold.ttf</string>
</array>

Example: Custom Font Implementation

MetaMap.shared.showMetaMapFlow(
    clientId: "YOUR_CLIENT_ID",
    flowId: "YOUR_FLOW_ID",
    metadata: [
        "regularFont": "Roboto-Regular.ttf",
        "boldFont": "Roboto-Bold.ttf"
    ]
)

Additional Metadata Options

Identity ID (Re-verification)

Pass an existing identity ID to update or re-verify a user:
metadata: ["identityId": "existing-identity-id"]

Encryption Configuration ID

Enable data encryption by providing an encryption configuration ID:
metadata: ["encryptionConfigurationId": "your-encryption-config-id"]

Custom Key-Value Pairs

You can also pass custom metadata that will be associated with the verification:
metadata: [
    "key1": "value1",
    "key2": 123,
    "userId": "user-12345",
    "source": "mobile-app"
]

Complete Customization Example

Here’s a comprehensive example combining multiple customization options:
import UIKit
import MetaMapSDK

class ViewController: UIViewController {
    @objc private func metaMapButtonAction() {
        MetaMap.shared.showMetaMapFlow(
            clientId: "YOUR_CLIENT_ID",
            flowId: "YOUR_FLOW_ID",
            metadata: [
                // Color customization
                "buttonColor": "#007AFF",
                "buttonTextColor": "#FFFFFF",
                
                // Language
                "fixedLanguage": "es",
                
                // Custom fonts
                "regularFont": "Roboto-Regular.ttf",
                "boldFont": "Roboto-Bold.ttf",
                
                // Custom metadata
                "userId": "user-12345",
                "source": "ios-app",
                "environment": "production"
            ]
        )
    }
}

Metadata Parameters Reference

ParameterTypeDescriptionDefault
buttonColorStringButton background color (hex)#FFFFFF
buttonTextColorStringButton text color (hex)#000000
fixedLanguageStringSDK interface languageen
regularFontStringRegular font filenameSystem font
boldFontStringBold font filenameSystem font
identityIdStringExisting identity ID for re-verification-
encryptionConfigurationIdStringEncryption configuration ID-

Best Practices

  1. Color Contrast: Ensure sufficient contrast between button color and text color for accessibility
  2. Font Files: Always test custom fonts on device to ensure they load correctly
  3. Language Selection: Choose the appropriate language based on user preferences or device locale
  4. Metadata Size: Keep custom metadata reasonable in size and avoid sensitive information
  5. Hex Colors: Always use the # prefix for hex color codes

Next Steps

Build docs developers (and LLMs) love