> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deepidv.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Selfie

> Capture a selfie with face guidance in the iOS SDK, inside a workflow or on its own with SelfieCaptureView.

The selfie screen guides the user to a centered, well-framed face and takes the photo automatically. In a [workflow](https://docs.deepidv.com/integrate/sdks/ios/workflows/run-a-workflow.md) it follows the document capture, and deepidv matches it against the face on the ID. On its own, `SelfieCaptureView` returns the photo to your app.

## Screens and states

![Front-camera screen: an oval guide with 'Position your face in the oval, the photo will be taken automatically'.](https://mintcdn.com/deep-identity-inc/KR_jLd52VE3haGnp/images/ios/selfie-position.webp?fit=max\&auto=format\&n=KR_jLd52VE3haGnp\&q=85\&s=4bf71d350eb0da16f752c6eabfd2dbe7)

![Front-camera screen: green oval with 'Hold still… taking the photo', and a manual shutter with 'Having trouble? Take the photo yourself'.](https://mintcdn.com/deep-identity-inc/KR_jLd52VE3haGnp/images/ios/selfie-hold-still.webp?fit=max\&auto=format\&n=KR_jLd52VE3haGnp\&q=85\&s=7bcbb3bdc1b78fc22b86f45a89582579)

![Front-camera screen: the photo frozen in the oval with a green tick, 'Got it! Your selfie was taken'.](https://mintcdn.com/deep-identity-inc/KR_jLd52VE3haGnp/images/ios/selfie-taken.webp?fit=max\&auto=format\&n=KR_jLd52VE3haGnp\&q=85\&s=e1960be4f58268d26ca963acd69b777f)

| State | Message | Oval |
| - | - | - |
| No face yet | **Position your face in the oval** · The photo will be taken automatically | White, pulsing |
| Too far | **Move a little closer** · Your face should fill the oval | Blue |
| Off center | **Center your face in the oval** · Look straight at the screen | Blue |
| Several faces | **Only your face, please** · Make sure no one else is in view | Amber |
| Ready | **Hold still…** · Taking the photo | Green |
| Taken | **Got it!** · Your selfie was taken, with the photo frozen in the oval | Green, with a tick |

If the photo hasn't been taken after a few seconds, **Having trouble? Take the photo yourself** and a shutter button appear. The **✕** closes the camera with `.cancelled`. The selfie always uses the front camera.

## On its own: `SelfieCaptureView`

`SelfieCaptureView` doesn't call deepidv. It returns the photo as a `FileInput`, for example to pass to [`verifyIdentity`](https://docs.deepidv.com/integrate/sdks/ios/headless/document-and-identity).

```swift theme={null}
SelfieCaptureView { result in
    switch result {
    case .success(let selfie):
        Task {
            let verification = try await client.verifyIdentity(
                documentFront: documentFront, selfie: selfie, type: .driversLicense)
            print("verified:", verification.verified)
        }
    case .failure(let error):
        if error.kind == .cancelled { return }
        print("selfie failed:", error.kind)
    }
}
```

| Parameter | Type | Description |
| - | - | - |
| `onResult` | `(Result<FileInput, DeepIDVError>) -> Void` | Called once with the JPEG, or an error: `.cancelled`, `.cameraPermissionDenied`, `.captureFailed`. |

## Guidance for your users

| Do | Don't |
| - | - |
| Face a window or a soft light | Sit with a bright window or lamp behind you |
| Hold the phone at eye level | Look down at the phone from below |
| Take off sunglasses and hats | Cover part of your face |
| Be the only person in view | Have someone else in the frame |

## Related

* [Face liveness](https://docs.deepidv.com/integrate/sdks/ios/face-liveness.md): proves the person is present, beyond a single photo
* [Failures and retries](https://docs.deepidv.com/integrate/sdks/ios/workflows/failures.md): selfie failures in workflows


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.