Skip to main content

Handling results:

When the OCR process completes, the OCRCameraUI view will call the callback function you provided with the OCRReponse. You can handle the response accordingly in your app.

// Images come as base64String you can convert 
public struct OCRResponse {
public let documentImages: [String: String]?
public let documentText: [String: String]?
}

Extension function to convert Base64Image

extension SwiftUI.Image {
init?(base64String: String) {
guard let data = Data(base64Encoded: base64String) else { return nil }
guard let uiImage = UIImage(data: data) else { return nil }
self = SwiftUI.Image(uiImage: uiImage)
}
}