Tap2iD SDK for iOS - Integration
Add the Tap2iD SDK to your iOS project via Swift Package Manager (SPM) using the provided repository URL.
Tap2iD-SDK-iOS on GitHubSystem Requirements
Your development environment must meet these requirements:
- π Supported iOS Versions: iOS 17.0 and later
- π¨ Xcode Version: 15.0 or later
- π± Hardware Requirements: iPhone 11 or newer with NFC enabled
Swift Package Manager
Add the Tap2iD SDK to your Xcode project using Swift Package Manager.
Open Xcode
Launch your project in Xcode.
Add Package Dependency
Go to File ⺠Add Package Dependencies⦠and enter the repository URL below.
https://github.com/CredenceID/Tap2iD-VerifierSDK-iOS.git
Specify Version
Choose Up to Next Major Version and specify X.X.X as the earliest version.
Add to Target
Select Tap2iD-VerifierSDK-iOS and add it to your app target.
Bluetooth Support
Open your project's Info.plist and add these Bluetooth usage description keys to enable BLE communication.
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Your app requires Bluetooth access to connect to nearby devices even in the background.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Your app needs to advertise and communicate with other Bluetooth devices.</string>
<key>NSBluetoothWhenInUseUsageDescription</key>
<string>Your app requires Bluetooth access to connect to nearby devices while in use.</string>
NFC Support
NFC requires both a capability entitlement in Xcode and additional keys in Info.plist.
Enable NFC Capability
Open your project in Xcode
Select your project in the navigator and click your app target.
Go to Signing & Capabilities
Select the Signing & Capabilities tab in the target editor.
Add Near Field Communication Tag Reading
Click + and search for Near Field Communication Tag Reading, then add it to your target.
Modify Info.plist
Add the NFC usage description and required identifiers to your Info.plist.
<key>NFCReaderUsageDescription</key>
<string>Your app requires NFC access to read mobile identity documents.</string>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>D2760000850101</string>
</array>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>12FC</string>
</array>
Add your license key
Generate your license key on the Tap2iD SDK License Key page, then pass it into CoreSdkConfig when you initialize the SDK. Do not hard-code the key. Store it in your project's secrets or environment.
let config = CoreSdkConfig(apiKey: "YOUR_API_KEY") // from verify.credenceid.com
Tap2iDVerifySDK.shared.initSdk(config: config) { error, message, profile in
if let error {
print("Init failed: (error)")
} else {
print("SDK ready")
}
}
Secrets.xcconfig or the iOS Keychain. Do not commit it to source control.
Example Usage
import Tap2iDVerifierSDK
class TestSDK {
var delegate: Tap2iDVerifySDKDelegate?
func initSDK(
apiKey: String,
result: @escaping (String?, String?, String?) -> Void
) {
let sdkConfig = CoreSdkConfig(apiKey: apiKey)
Tap2iDVerifySDK.shared.initSdk(config: sdkConfig) { error, message, profile in
result(error, message, profile)
}
}
func startQrEngagement(
capturedQr: String,
result: @escaping (Error?) -> Void
) {
let error = Tap2iDVerifySDK.shared.verifyMdoc(
engagementConfig: .qrCode(capturedQr),
delegate: self
)
if let error { result(error) }
}
func startPdfEngagement(
pdf417: String,
result: @escaping (Error?) -> Void
) {
let error = Tap2iDVerifySDK.shared.verifyMdoc(
engagementConfig: .pdf417(pdf417),
delegate: self
)
if let error { result(error) }
}
func startNativeNfcEngagement(
result: @escaping (Error?) -> Void
) {
let error = Tap2iDVerifySDK.shared.verifyMdoc(
engagementConfig: .nfc,
delegate: self
)
if let error { result(error) }
}
func startExternalNfcReaderEngagement(
readerDelegate: NfcExternalReaderDelegate,
result: @escaping (Error?) -> Void
) {
let error = Tap2iDVerifySDK.shared.verifyMdoc(
engagementConfig: .nfcExternalReader,
delegate: self,
readerDelegate: readerDelegate
)
if let error { result(error) }
}
func stopMonitoring() {
Tap2iDVerifySDK.shared.stopMonitoring()
}
}
Tap2iDVerifySDKDelegate
extension TestSDK: Tap2iDVerifySDKDelegate {
func onVerificationStageStarted(stage: VerificationStage) {
// Handle verification stage start
}
func onVerificationStageError(
stage: VerificationStage?,
error: CoreCredenceErrorStruct?
) {
// Handle verification error
}
func onVerificationStageCompleted(stage: VerificationStage) {
// Handle verification stage completion
}
func onVerificationCompleted(
verificationResult: VerificationResult?
) {
// Handle final verification result
}
}
NfcExternalReaderDelegate
extension TestSDK: NfcExternalReaderDelegate {
func didDetectReaders() {
// External NFC reader detected
}
func didDisconnectFromReader() {
// External reader disconnected
}
func didDetectSmartCard() {
// Smart card detected
}
func didDisconnectFromSmartCard() {
// Smart card disconnected
}
}