Skip to content

Show scanner

When the initialization is completed and the scenario is set, you can start the document scanning process:

DocReader.shared.showScanner(self) { (action, result, error) in
    switch action {
    case .cancel:
        print("Cancelled by user")
    case .complete:
        print("Completed")
        guard let result = result else { return }
        print("Result class: \(result)")
    case .error:
        print("Error: \(error)")
    case .process:
        guard let result = result else { return }
        print("Scanning is not finished. Result: \(result)")
    }
}
[RGLDocReader.shared showScanner:self completion:^(enum RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable result, NSError * _Nullable error) {
    switch (action) {
        case RGLDocReaderActionCancel: {
            NSLog(@"Cancelled by user");
        }
        break;

        case RGLDocReaderActionComplete: {
            NSLog(@"Completed");
            NSLog(@"Result class: %@", result);
        }
        break;

        case RGLDocReaderActionError: {
            NSLog(@"Error string: %@", error);
        }
        break;

        case RGLDocReaderActionProcess: {
            NSLog(@"Scanning is not finished. Result: %@", result);
        }
        break;

        default:
        break;
    }
}];
Back to top