iOS
Latest version: 2.5.6
Getting started
In order to perform an Onboarding or an Authenticate, you should follow those steps:
- Set up the SDK: install and import the SDK
- Get a token: request a token using your business credentials
- Start an onboarding or authenticate flow: launch a user workflow
- Get the user workflow result from SDK: use the Message handler to get insights about the user workflow
- Get the Analysis result: use your callback or the endpoint to get the analysis result
1. Set up the SDK
1.1. Project requirements
The proper functioning of the SDK necessitates the provision of several parameters. These parameters are essential for enabling the full range of functionalities offered by the SDK.
- iOS 15+ (because of Swift minimum version)
- Available for iPhone and iPad in portrait mode only
Warning
๐ธ Mandatory for camera permissions
The SDK uses the device's camera functionalities.
You must add the following key in your application's Info.plist file:
NSCameraUsageDescriptionโ for camera access (see Apple documentation for more details)
Example:
Warning
๐ก NFC Permissions and Capabilities
The SDK requires access to the deviceโs NFC features.
1. Enable NFC Capability
- Activate Near Field Communication Tag Reading for your App ID in the Apple Developer Portal.
- In Xcode โ Signing & Capabilities, add Near Field Communication Tag Reading.
(Xcode will automatically include the necessary entitlement in your.entitlementsfile.) - In your
Info.plist, define a clear and explicit usage message forNFCReaderUsageDescription.
Example:
<key>NFCReaderUsageDescription</key>
<string>This app requires access to NFC to read identity documents.</string>
2. Configure Entitlements
If your app needs to support specific NFC protocols or identifiers (such as ISO7816, AID, or NDEF), extend your entitlements as shown below:
Example โ .entitlements file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
<string>PACE</string>
</array>
</dict>
</plist>
3. Optional: Add Supported Identifiers
If required, you can also define additional supported identifiers directly in your Info.plist.
These are not mandatory but may be necessary for advanced use cases.
Example โ Info.plist:
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>A0000002472001</string>
<string>D4100000030001</string>
<string>D2760000850101</string>
</array>
For more details, refer to Appleโs CoreNFC documentation.
Note
The Camera permission is mandatory for all SDK functionalities.
The NFC permission is optional and only required if the credentials include access to NFC functionality.
1.2. Install SDK
ShareID supports CocoaPods with authenticate handled via a .netrc file.
To securely manage your credentials, youโll need to create a .netrc file in your home directory with the necessary login details.
- Create and open
Type touch ~/.netrc & open ~/.netrc
- Add login details
- Set file permissions
chmod 600 ~/.netrc
1.3. Add the dependency
To install the SDK with CocoaPods, you'll need to add the dependency to your Podfile. (if it doesn't exist, create one by running the following command in your project directory: pod init)
- Add the following to your target
platform :ios, '15.0'
target '<your-app>' do
use_frameworks!
pod 'shareid-sdk-ios' # or specific version
end
- Run
pod installto install the dependency - Now, you can import and use the SDK in your project
2. Get a token
Use the credentials you received from ShareID's team to get an authentication token and launch an onboarding or authenticate workflow.
Depending on the SDK you are integrating (Onboarding/Authenticate), you may use an API here Get a Token
3. Start an onboarding or authenticate flow
Once you have added the SDK as a dependency and have your credentials, you can configure the SDK.
The service specifies the service in the SDK:
onboardingstarts the onboarding processauthenticatestarts the authenticate process
Info
The initial SDK screen is automatically triggered upon execution of the method above.
4. Get the user workflow result from SDK
To receive feedback from the SDK, you need to implement the messageHandler closure, which manages various responses from the ShareID process.
This closure is triggered when the ShareID SDK completes an operation, fails, or encounters an error.
ShareID.shared.messageHandler = { (result: ShareID.Result) in
switch result.type {
case .success:
// ...
case .exit:
// ...
case .failure:
// ...
}
}
To view all possible end-of-process results in our SDK, please refer to the Message Handler for all success, exit and failure states.
5. Get the analysis result
When the processing of an onboarding or authenticate request is finished, you may receive the result through the callback if you provided it. You may also, fetch yourself the result by calling our API.
See Get the analysis result for more details.
Customisation
The ShareID iOS SDK is built to be highly customisable, allowing for flexibility through various configuration options or by applying themes to adapt the user interface to your needs.
Configuration
To customise the SDK, pass a ShareID.Theme after building the flow.
Set the colors
| Name | Message | Color |
|---|---|---|
primary |
The main color | ShareID blue (if nothing defined) |
secondary |
The main title text color | Black or White (depending on your iPhone theme and if nothing is set) |
The SDK uses the device language, but you can use the language parameter to force a language before initialising the SDK.
By default, the SDK will display ShareID's default Terms and Privacy Policy links.
You can overwrite them with your own URLs by setting them before starting the flow:
The SDK provides several options to control the display of certain default screens and texts.
You can enable or disable them before starting the flow:
| Parameter | Default | Description |
|---|---|---|
| shouldShowError | true |
Controls whether the SDK automatically displays an error screen when an error occurs. If set to false, you must handle errors manually using the response handler. |
| shouldShowAgreement | true |
Controls whether the default Agreement screen is shown at the start of the onboarding process. |
Warning
- Disabling
shouldShowErrorexposes the SDK to potential malfunctions if you do not properly handle errors in your application.
When autoDismiss is set to true, the SDK automatically closes at the end of the flow, returning the user to the initial screen where the SDK was started.
By default, this value is set to true.
Localisation
Languages supported:
- ๐ธ๐ฆ (ar), ๐ฉ๐ช (de), ๐ฌ๐ง (en), ๐ช๐ธ (es), ๐ซ๐ท (fr), ๐ฎ๐น (it), ๐ต๐ฑ (pl), ๐ต๐น (pt), ๐ท๐ด (ro), ๐ท๐บ (ru), ๐ฌ๐ท (gr)
Warning
Be sure to add CFBundleLocalizations to your Info.plist file with all the languages you want to support in your application. (This ensures that default Apple buttons are properly localised and enables RTL navigation)