Swift SDK
A SwiftUI flow for iOS 16 and newer that collects the requested documents, runs the liveness challenge and location step, and sends the evidence for review.
CredflareSDK product. It has no external runtime dependencies.Add the guided flow
import CredflareSDK
CredflareVerificationView(sessionProvider: {
try await yourBackend.createApplicantSession() // returns SessionDescriptor
}, autoStart: true) { result in
switch result {
case .submitted: refreshStatus()
case .hostActionRequired: showYourOwnSteps()
case .cancelled: dismiss()
}
} SessionDescriptor decodes the session JSON your backend returns, as shown in the server example. It rejects a non-HTTPS API URL outside localhost.
| Result | Meaning |
|---|---|
.submitted | Nothing is left to collect. This is a receipt, not a decision. |
.hostActionRequired(code:) | The SDK collected what it can, but the case still needs something your app handles. code is the rejection code when the applicant left from a leave rejection, such as phone.not_configured, and nil when questions or checks the SDK does not collect remain. |
.cancelled | The applicant closed the flow. The case stays open. |
Present the view in a sheet or full-screen cover. Its Close control reports .cancelled. The view asks the questions and collects the documents, then runs the case's facial, location, email and phone requirements in profile order before the receipt.
Liveness and location
- The facial step requests a liveness challenge, runs its gestures on a mirrored front camera preview, keeps a frame per gesture, records a short silent H.264 video when the challenge asks for one, then takes the selfie.
- Face signals come from Apple Vision through the default
VisionFaceSignalProvider. PassfaceSignalProvidertoCredflareVerificationViewto use another provider, andlocationSourceto replace the location source. is_mockis whether iOS marks the fix as simulated by software.- A rejection shows the rejection screen for its code. Starting a challenge step again requests a new challenge.
Questions and codes
- The view asks every question type except
founders, which returns to your app.Questionnaireevaluatesshow_ifand checks answers. - The email and phone steps send a code, take it and confirm it.
- After every submission and code confirmation, the view fetches the session again and follows the refresh rule.
SessionInfo.nextStepnames the next outstanding step. Rejectionmaps a422to its screen, with the requester's help contact fromrequester.helpEmailandrequester.helpURL.
Build your own screens
VerificationSession offers async get(), upload(), submit(), createLivenessChallenge(), uploadBiometric(), submitFacial(), submitLocation(), requestCode(), confirmCode(), submitAnswers(), refresh(), replaceSession() and cancel(). Uploads and submissions take a UUID retry key. Reuse the key with the same evidence after a network failure.
Configure the app
- Add
NSCameraUsageDescription(documents and the liveness challenge) andNSLocationWhenInUseUsageDescription(location step) to the app'sInfo.plist. The video has no sound, so no microphone permission is needed. - The iOS simulator has no usable camera. Test uploads there and camera capture, including liveness, on a device.
Read how the SDKs work for capture methods, receipts and error handling.