iOS WebView implementation guide

Prev Next

This guide explains how to bring Veriff’s verification flow into your iOS application using WebViews.

Veriff supports two WebView implementations, each with different use cases and requirements.

WebView options

SFSafariViewController

  • Provides a full-screen native browser experience

  • Compatible only with the Redirect approach

  • Requires JavaScript binding for InContext SDK

WKWebView (recommended)

  • Embeds web content directly within your native app

  • Offers greater JavaScript control and customization

  • Recommended for most use cases


Required OS Permissions

Add these permissions to your Info.plist before integrating the verification flow:

Key

Description

Privacy - Camera Usage Description

This app uses the camera to capture photos and videos

Privacy - Microphone Usage Description

This app uses the microphone to record videos with audio

Note: If you do not need audio in the video recordings, you can request audio to be disabled for your integration.


WKWebView configuration

The following settings are essential for proper WebView functionality in Veriff’s verification flow:

Key WebView settings

// SETTING: Allow inline video/camera playback

// WHAT IT DOES: Enables videos to play within the WebView rather than fullscreen

// DOCS: https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback

webViewConfig.allowsInlineMediaPlayback = true

// SETTING: Disable user interaction requirement for media playback

// WHAT IT DOES: Critical for allowing camera access without user tap/interaction

// DOCS: https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1851524-mediatypesrequiringuseractionfor

webViewConfig.mediaTypesRequiringUserActionForPlayback = []

// SETTING: Enable HTTPS upgrades (iOS 15+)

// WHAT IT DOES: Automatically upgrades HTTP connections to HTTPS when possible

// DOCS: https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/3752243-upgradeknownhoststohttps

if #available(iOS 15.0, *) {

    webViewConfig.upgradeKnownHostsToHTTPS = true

}

// SETTING: Enable JavaScript (iOS 15+)

// WHAT IT DOES: Ensures JavaScript is enabled, which is required for the web application

// DOCS: https://developer.apple.com/documentation/webkit/wkwebpagepreferences/allowscontentjavascript/

if #available(iOS 15.0, *) {

    let preferences = WKWebpagePreferences()

    preferences.allowsContentJavaScript = true

    webViewConfig.defaultWebpagePreferences = preferences

}

// SETTING: Configure content inset adjustment behavior

// WHAT IT DOES: Prevents automatic content insets that could affect layout

// DOCS: https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior-swift.property

webView.scrollView.contentInsetAdjustmentBehavior = .never

// SETTING: Set delegate for handling navigation events

// WHAT IT DOES: Required for intercepting URL changes and handling redirects

// DOCS: https://developer.apple.com/documentation/webkit/wknavigationdelegate

webView.navigationDelegate = yourNavigationDelegate

Camera permission handler (iOS 15+)

Implement this delegate method to handle camera permissions before Veriff’s verification flow starts:

// DELEGATE METHOD: Handle camera permission requests

// WHAT IT DOES: Allows auto-approval of camera permissions for trusted domains

// DOCS: https://developer.apple.com/documentation/webkit/wkuidelegate/3763087-webview

@available(iOS 15.0, *)

func webView(_ webView: WKWebView,

            requestMediaCapturePermissionFor origin: WKSecurityOrigin,

            initiatedByFrame frame: WKFrameInfo,

            type: WKMediaCaptureType,

            decisionHandler: @escaping (WKPermissionDecision) -> Void) {

    // Auto-approve camera access for trusted domains

    if origin.host.contains("VERIFF END USER FLOW DOMAINS") {

        decisionHandler(.grant)

    } else {

        // For all other domains, show the permission prompt

        decisionHandler(.prompt)

    }

}


Safe Areas

For safe area handling, we only support WKWebView on iOS. To make this work, ensure the following is met:

  •  wkWebView.scrollView.contentInsetAdjustmentBehavior = .never is set

  • .ignoresSafeArea(.all) is set

  • The use_ios_safe_area_padding_web flag is set to true on the desired integration


Changelog

Date

Description

Jun 6, 2025

Heading “Article versioning” changed to “Changelog”

May 15, 2025

Documentation published