From 2388a67996553cec7ae1c679c4b072fcb0090018 Mon Sep 17 00:00:00 2001 From: Philip Dukhov Date: Sun, 9 Feb 2020 01:10:39 +0700 Subject: [PATCH 1/2] preview frame fix in case of using SwiftyCamViewController as a child vc --- Source/SwiftyCamViewController.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/SwiftyCamViewController.swift b/Source/SwiftyCamViewController.swift index 1497a33..7c4d573 100644 --- a/Source/SwiftyCamViewController.swift +++ b/Source/SwiftyCamViewController.swift @@ -356,9 +356,7 @@ open class SwiftyCamViewController: UIViewController { } - override open func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - + private func updatePreviewLayer() { if let connection = self.previewLayer?.videoPreviewLayer.connection { let currentDevice: UIDevice = UIDevice.current @@ -394,6 +392,11 @@ open class SwiftyCamViewController: UIViewController { } } + override open func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + updatePreviewLayer() + } + // MARK: ViewWillAppear /// ViewWillAppear(_ animated:) Implementation @@ -430,6 +433,7 @@ open class SwiftyCamViewController: UIViewController { // Preview layer video orientation can be set only after the connection is created DispatchQueue.main.async { self.previewLayer.videoPreviewLayer.connection?.videoOrientation = self.orientation.getPreviewLayerOrientation() + updatePreviewLayer() } case .notAuthorized: From dd67d4af06e2ccb306e795497191e99cbb2e6746 Mon Sep 17 00:00:00 2001 From: Philip Dukhov Date: Sat, 11 Apr 2020 09:35:32 +0700 Subject: [PATCH 2/2] typo fix --- Source/SwiftyCamViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SwiftyCamViewController.swift b/Source/SwiftyCamViewController.swift index 7c4d573..dde5f93 100644 --- a/Source/SwiftyCamViewController.swift +++ b/Source/SwiftyCamViewController.swift @@ -433,7 +433,7 @@ open class SwiftyCamViewController: UIViewController { // Preview layer video orientation can be set only after the connection is created DispatchQueue.main.async { self.previewLayer.videoPreviewLayer.connection?.videoOrientation = self.orientation.getPreviewLayerOrientation() - updatePreviewLayer() + self.updatePreviewLayer() } case .notAuthorized: