Skip to content

Commit b35892a

Browse files
committed
Separate extension for UIAdaptivePresentationControllerDelegate
1 parent a199c82 commit b35892a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Sources/CodeScanner/ScannerViewController.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import UIKit
1212
@available(macCatalyst 14.0, *)
1313
extension CodeScannerView {
1414

15-
public class ScannerViewController: UIViewController, UINavigationControllerDelegate, UIAdaptivePresentationControllerDelegate {
15+
public class ScannerViewController: UIViewController, UINavigationControllerDelegate {
1616
private let photoOutput = AVCapturePhotoOutput()
1717
private var isCapturing = false
1818
private var handler: ((UIImage) -> Void)?
@@ -56,11 +56,6 @@ extension CodeScannerView {
5656
openGallery()
5757
}
5858

59-
public func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
60-
// Gallery is no longer being presented
61-
isGalleryShowing = false
62-
}
63-
6459
#if targetEnvironment(simulator)
6560
override public func loadView() {
6661
view = UIView()
@@ -524,6 +519,15 @@ extension CodeScannerView.ScannerViewController: UIImagePickerControllerDelegate
524519
}
525520
}
526521

522+
// MARK: - UIAdaptivePresentationControllerDelegate
523+
524+
extension CodeScannerView.ScannerViewController: UIAdaptivePresentationControllerDelegate {
525+
public func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
526+
// Gallery is no longer being presented
527+
isGalleryShowing = false
528+
}
529+
}
530+
527531
@available(macCatalyst 14.0, *)
528532
extension CodeScannerView.ScannerViewController: AVCapturePhotoCaptureDelegate {
529533

0 commit comments

Comments
 (0)