Skip to content

Commit 7215d56

Browse files
committed
Update the orientation of the previewLayer connection instead of the last one
1 parent 5e88643 commit 7215d56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/CodeScanner/ScannerViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ extension CodeScannerView {
148148

149149
@objc func updateOrientation() {
150150
guard let orientation = view.window?.windowScene?.interfaceOrientation else { return }
151-
guard let connection = captureSession?.connections.last, connection.isVideoOrientationSupported else { return }
151+
guard let connection = previewLayer.connection, connection.isVideoOrientationSupported else { return }
152152
switch orientation {
153153
case .portrait:
154154
connection.videoOrientation = .portrait

0 commit comments

Comments
 (0)