I'm looking for implement IRLDocumentScanner CocoaPods like nativescript plugin. I have correctly installed Pod, and have test if I can access in native code from IRLScannerViewController
.
Based on documentation for Object C have tried but have crash on save! myScanner.ios.ts
import { Common } from './myScanner.common';
declare var IRLScannerViewController: any
export class myScanner extends Common {
constructor() {
super()
}
public createNativeView() {
const session = new AVCaptureSession();
session.sessionPreset = AVCaptureSessionPreset1280x720;
const device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);
const input = AVCaptureDeviceInput.deviceInputWithDeviceError(device);
if (!input) {
throw new Error("Error trying to open camera.");
}
session.addInput(input);
session.startRunning();
const videoLayer = AVCaptureVideoPreviewLayer.layerWithSession(session);
const camereraView = UIView.alloc().initWithFrame({ origin: { x: 0, y: 0 }, size: { width: 400, height: 600 } });
camereraView.backgroundColor = UIColor.blueColor;
videoLayer.frame = camereraView.bounds;
camereraView.layer.addSublayer(videoLayer);
this.cameraView = camereraView
return this.cameraView
}
public initNativeView() {
let delegate = IRLScannerViewControllerDelegate.prototype
const scanner = IRLScannerViewController.standardCameraViewWithDelegate(delegate)
scanner.presentViewControllerAnimatedCompletion(scanner, true, null);
}
public destroyNativeView() {
}
}