Docs › Recipes
iOS (Swift)
The ScreenlyyID iOS example is the reference for a native iOS app. It has two parts, and the split matters:
backend/: a small Node server that holds the API key and theCorrelationIdand makes every ScreenlyyID call. You can swap it for your own server, for instance the Express or FastAPI recipes, which have the same two routes.DemoCamera/: the app. It contains no API key. It asks the back end to create a verification, asks for camera permission, opens thewebEnrolmentUrlin aWKWebView, listens forIDV_SESSION_COMPLETEandERROR, then asks the back end for the result.
Follow the steps and the camera-permission notes on the Mobile app page. The example's README explains how to run both parts on a real device (the simulator has no camera).
The pieces to copy:
| What | File in the example |
|---|---|
| Ask the back end for a session and for the result | DemoCamera/LaunchViewController.swift (Backend) |
| Ask for camera permission before loading the page, send the user to Settings if denied | DemoCamera/HomeViewController.swift |
WKWebView with the event listener (a WKUserScript forwards message events) | DemoCamera/ViewController.swift |
One request for the result after IDV_SESSION_COMPLETE | DemoCamera/SuccessViewController.swift |
| The server routes | backend/server.mjs |