DC SDK iOS Sample app 

1. Overview 

To illustrate the usage of the DigitalCredential SDK, we provide a MobileIDSampleApp application that demonstrates how the SDK can be initialized and how various features can be used.

The sample app targets iOS devices and implements its interface using SwiftUI.

The app links against MobileIDCore, the main SDK library, as well as multiple enrollment plugins responsible for different modes of enrollment. It also uses MobileIDInPersonSharing for ISO 18013 functionality.

The sample app can be found in Artifactory next to the SDK in a file named MobileID-X.X.X-sampleapp.zip.

2. Goals of the Sample App 

The sample app demonstrates the following:

  1. How to initialize the SDK using MobileIDConfiguration and EnvironmentConfiguration (Main and EnvironmentSetup)
  2. How to implement an enrollment process in the app (EnrollmentCoordinator)
  3. How to implement online authentication (OnlineAuthenticationCoordinator)
  4. How to implement ISO 18013 presentment (OnlinePresentmentCoordinator)
  5. How to query and manage credential data (IDsView)
  6. How to implement Digital Credentials API support using the extension inside the DigitalCredentialExtension folder

In addition to demonstrating individual features, the sample app also shows how these flows can be connected in a single application. Developers can use it to understand the expected order of operations, the required configuration, and the responsibilities of the host application when integrating with the SDK.

The sample app is not intended to represent a production-ready application. Instead, it focuses on clarity and discoverability, so that SDK usage patterns can be reviewed, copied, and adapted to a client application.

3. Main Components 

The sample app is organized around a few key components that represent the most important integration areas.

SDK Initialization 

SDK initialization is performed using MobileIDConfiguration and EnvironmentConfiguration. These types define the required runtime configuration and environment-specific values needed by the SDK.

Please contact your IDEMIA representative to obtain an example configuration file and access to an environment.

The relevant implementation can be found in EnvironmentSetup and Main. EnvironmentSetup reads environment data from a QR code to allow for quick setup, while Main shows how the data from the code can be used to start the SDK inside the startMobileID function.

Enrollment 

Enrollment is handled by EnrollmentCoordinator. This component demonstrates how the app can start and manage the enrollment process using the available enrollment plugins.

The file shows how the process can be started or resumed. In addition, EnrollmentPresenter drives the UI and presents the appropriate views.

Pin Management 

PIN management is implemented using the PinManager class provided by the SDK. The sample app demonstrates how to use it in the showPinSetup method of MainScreenView.ViewModel, where the PIN setup flow can be started and handled by the host application.

An example of PIN usage is also demonstrated with PinFeedbackView, which shows how PIN-related feedback can be presented to the user.

Online Authentication 

Online authentication is demonstrated in OnlineAuthenticationCoordinator. This part of the sample app shows how an app can start an authentication flow, handle the result, and react to success or failure. The flow starts by scanning a QR code in ScannerView and then reacting to a LoginRequest.

ISO 18013 Presentment 

ISO 18013 presentment is implemented using OnlinePresentmentCoordinator and the MobileIDInPersonSharing library.

This demonstrates how credential presentment can be integrated into the app and how SDK functionality can be exposed through a simple user flow.

Credential Management 

Credential querying and management are demonstrated in IDsView. This view shows how the app can retrieve available credentials and present them to the user. It also shows how a credential can be removed.

It can be used as a starting point for understanding how Wallet credential data is exposed by the SDK and how an application can build its own credential management UI.

Digital Credentials API Extension 

Digital Credentials API support is implemented using the extension located inside the DigitalCredentialExtension folder. The extension also requires data to be shared with it by using the DigitalCredentialContextProvider.update() method.

This part of the sample app demonstrates the required extension structure and shows how the app integrates SDK functionality with the system-level Digital Credentials API flow.

For this to work properly, the following requirements must be met:

  1. An App Group must be registered for both the app and the extension so that data can be shared between them.
  2. The Digital Credential entitlement for the required document type must be granted to the app.

4. How to Run 

Assuming Artifactory access to the SDK has been granted, the initial setup can be performed using the setup.sh script located in the app folder. From there a .xcworkspace file can be used to build and run the application in Xcode.

More information can be found in the README file inside the sample app directory.