From b1b57e68aac3a20a1fb565f1d9f8663700b99de8 Mon Sep 17 00:00:00 2001 From: Manuel Weiel Date: Fri, 23 Aug 2024 11:27:59 +0200 Subject: [PATCH] fix strong reference cycle as outlined in #150 --- Sources/CodeScanner/ScannerViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/CodeScanner/ScannerViewController.swift b/Sources/CodeScanner/ScannerViewController.swift index 87930cb..8241115 100644 --- a/Sources/CodeScanner/ScannerViewController.swift +++ b/Sources/CodeScanner/ScannerViewController.swift @@ -448,7 +448,8 @@ extension CodeScannerView.ScannerViewController: AVCaptureMetadataOutputObjectsD return } - handler = { [self] image in + handler = { [weak self] image in + guard let self else { return } let result = ScanResult(string: stringValue, type: readableObject.type, image: image, corners: readableObject.corners) switch parentView.scanMode {