diff --git a/BarcodeScanning.Native.Maui/Platform/MaciOS/BarcodeView.cs b/BarcodeScanning.Native.Maui/Platform/MaciOS/BarcodeView.cs index d2687c8..62fd11c 100644 --- a/BarcodeScanning.Native.Maui/Platform/MaciOS/BarcodeView.cs +++ b/BarcodeScanning.Native.Maui/Platform/MaciOS/BarcodeView.cs @@ -31,8 +31,9 @@ public override void LayoutSubviews() { _previewLayer.Frame = layer.Bounds; - if (_previewLayer.Connection is not null && _previewLayer.Connection.SupportsVideoOrientation) - _previewLayer.Connection.VideoOrientation = this.Window?.WindowScene?.InterfaceOrientation switch + var connection = _previewLayer.Connection; + if (connection is not null && connection.SupportsVideoOrientation) + connection.VideoOrientation = this.Window?.WindowScene?.InterfaceOrientation switch { UIInterfaceOrientation.LandscapeLeft => AVCaptureVideoOrientation.LandscapeLeft, UIInterfaceOrientation.LandscapeRight => AVCaptureVideoOrientation.LandscapeRight,