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

# iOS SDK Logging and Webhooks

> Handle iDenfy iOS SDK callbacks, lifecycle logging, and verification event webhooks in Swift and Objective-C with practical code examples.

## Logging

The SDK provides a way to log user and SDK common actions (lifecycle events, navigation, camera changes). This can be useful for understanding specific scenarios or troubleshooting potential issues.

To enable logging, provide your implementation of the **IdenfyLoggingHandlerUseCase** class:

```swift theme={"system"}
        let consoleLogging = ConsoleLoggingImpl()
        idenfyController.setIdenfyLoggingHandler(idenfyLoggingHandler: IdenfyLoggingHandlerUseCaseImpl(consoleLogging))
```

```swift theme={"system"}
class ConsoleLoggingImpl {
    func log(event: String, message: String, token _: String) {
        print("SDKLog", event, " - ", message)
    }
}
```

```swift theme={"system"}
import iDenfySDK

class IdenfyLoggingHandlerUseCaseImpl: IdenfyLoggingHandlerUseCase {
    private var consoleLogging: ConsoleLoggingImpl!

    init(_ consoleLogging: ConsoleLoggingImpl) {
        self.consoleLogging = consoleLogging
    }

    func logEvent(event: String, message: String, token: String) {
        #if DEBUG
            consoleLogging.log(event: event, message: message, token: token)
        #endif
    }
}

```

## User Events Webhooks

The SDK provides webhooks about events occurring throughout the verification process. Results are delivered while the verification process is active and the application is presenting SDK views.

### Declare a Class for Receiving Events

Declare a class that implements `IdenfyUserFlowHandler` to call your backend service, log events, or apply changes:

<Tabs>
  <Tab title="Swift">
    ```swift theme={"system"}
    import iDenfySDK

    @objc public class IdenfyUserFlowCallbacksHandler: NSObject, IdenfyUserFlowHandler {
        public func onPhotoUploaded(photo: String, step: String) {
            print("IdenfyUserFlowHandler - onPhotoUploaded \(step)")
        }

        public func onDocumentSelected(documentType: String) {
            print("IdenfyUserFlowHandler - onDocumentSelected \(documentType)")
        }

        public func onCountrySelected(issuingCountryCode: String) {
            print("IdenfyUserFlowHandler - onCountrySelected \(issuingCountryCode)")
        }

        public func onProcessingStarted(processingStarted: Bool) {
            print("IdenfyUserFlowHandler - onProcessingStarted \(processingStarted)")
        }
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    ```Objective-C theme={"system"}

    /// IdenfyUserFlowCallbacksHandler.h

    #import <Foundation/Foundation.h>
    #import <iDenfySDK/iDenfySDK-Swift.h>

    @interface IdenfyUserFlowCallbacksHandler: NSObject <IdenfyUserFlowHandler>

    @end

    /// IdenfyUserFlowCallbacksHandler.m

    #import "IdenfyUserFlowCallbacksHandler.h"

    @implementation IdenfyUserFlowCallbacksHandler

    - (void)onCountrySelectedWithIssuingCountryCode:(NSString * _Nonnull)issuingCountryCode {
        NSLog(@"IdenfyUserFlowHandler - onCountrySelected %@", issuingCountryCode);
    }

    - (void)onDocumentSelectedWithDocumentType:(NSString * _Nonnull)documentType {
        NSLog(@"IdenfyUserFlowHandler - onDocumentSelected %@", documentType);
    }

    - (void)onPhotoUploadedWithPhoto:(NSString * _Nonnull)photo step:(NSString * _Nonnull)step {
        NSLog(@"IdenfyUserFlowHandler - onPhotoUploaded %@", step);
    }

    - (void)onProcessingStartedWithProcessingStarted:(BOOL)processingStarted {
        NSLog(@"IdenfyUserFlowHandler - onProcessingStarted %id", processingStarted);
    }

    @end


    ```
  </Tab>
</Tabs>

### Set the idenfyUserFlowCallbacksHandler

Set the `idenfyUserFlowCallbacksHandler` in the `IdenfyController` class:

<Tabs>
  <Tab title="Swift">
    ```swift theme={"system"}
    ...
    idenfyController.setIdenfyUserFlowCallbacksHandler(idenfyUserFlowHandler: IdenfyUserFlowCallbacksHandler())
    ...
    ```
  </Tab>

  <Tab title="Objective-C">
    ```Objective-C theme={"system"}
    ...
    IdenfyUserFlowCallbacksHandler *idenfyUserFlowCallbackHandler = [[IdenfyUserFlowCallbacksHandler alloc] init];
    [idenfyController setIdenfyUserFlowCallbacksHandlerWithIdenfyUserFlowHandler:idenfyUserFlowCallbackHandler];
    ...
    ```
  </Tab>
</Tabs>
