Hi!
I'm trying to open the barcode scanner from class "Partynallen" with a button placed in "NewViewController". I can get the barcode to open and scan stuff, but the image freezes and no result is being passed. What could i possibly be doing wrong?
Appreciate any help provided, thanks in advance.
import QRCodeReader
import Alamofire
class Partynallen: UIViewController, QRCodeReaderViewControllerDelegate {
		lazy var readerVC: QRCodeReaderViewController = {
		let builder = QRCodeReaderViewControllerBuilder {
		//change object to scan and the initial position of the camera
				$0.reader = QRCodeReader(metadataObjectTypes: [.qr, .ean13], captureDevicePosition: .back)
		// Configure the view controller (optional)
		$0.showTorchButton = true
		$0.showSwitchCameraButton = false
		$0.showCancelButton = true
		$0.showOverlayView = true //shows the square area of the QRCode Scanner
				$0.rectOfInterest = CGRect(x: 0, y: 0, width: 1, height: 1)
		}
		return QRCodeReaderViewController(builder: builder)
		}()
		
		
		
		override func viewDidLoad() {
				super.viewDidLoad()
				// Do any additional setup after loading the view.
				readerVC.delegate = self
		}
		
		func reader(_ reader: QRCodeReaderViewController, didScanResult result: QRCodeReaderResult) {
		//code to be added
				reader.stopScanning()
				//print(result)
				//print(result.value)
				//barcode = result.value
			 //Apifetch(code: "URL")
				dismiss(animated: true, completion: nil)
		}
		func readerDidCancel(_ reader: QRCodeReaderViewController) {
		//code to be added
				reader.stopScanning()
				dismiss(animated: true, completion: nil)
		}
		
}
class NewViewController: UIViewController {
		
		
		override func viewDidLoad() {
				super.viewDidLoad()
				// Do any additional setup after loading the view.
				Partynallen().readerVC.delegate = Partynallen().self // DONT KNOW IF THIS IS CORRECT?
		}
				@IBAction func scan(_ sender: UIButton) {
						Partynallen().readerVC.modalPresentationStyle = .formSheet
						present(Partynallen().readerVC, animated: true)
		}
		
		
}
Selecting any option will automatically load the page