Skip to content

Commit

Permalink
Re-center the camera frame when the views are laid out
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas committed Jul 11, 2024
1 parent 46ab0a4 commit a6db2cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 0 additions & 4 deletions HostApp/HostApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
97D1A8E92BA3757700FF1368 /* AWSAPIPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 97D1A8E82BA3757700FF1368 /* AWSAPIPlugin */; };
97D1A8EB2BA3757700FF1368 /* AWSCognitoAuthPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 97D1A8EA2BA3757700FF1368 /* AWSCognitoAuthPlugin */; };
97D1A8ED2BA3757700FF1368 /* Amplify in Frameworks */ = {isa = PBXBuildFile; productRef = 97D1A8EC2BA3757700FF1368 /* Amplify */; };
97D1A8EF2BA375AA00FF1368 /* amplify-ui-swift-liveness in Resources */ = {isa = PBXBuildFile; fileRef = 97D1A8EE2BA375AA00FF1368 /* amplify-ui-swift-liveness */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -308,8 +307,6 @@
Base,
);
mainGroup = 9070FF97285112B4009867D5;
packageReferences = (
);
productRefGroup = 9070FFA1285112B4009867D5 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -328,7 +325,6 @@
files = (
973619262BA378690003A590 /* awsconfiguration.json in Resources */,
9070FFAB285112B5009867D5 /* Preview Assets.xcassets in Resources */,
97D1A8EF2BA375AA00FF1368 /* amplify-ui-swift-liveness in Resources */,
9070FFA8285112B5009867D5 /* Assets.xcassets in Resources */,
973619252BA378690003A590 /* amplifyconfiguration.json in Resources */,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ final class _LivenessViewController: UIViewController {
super.viewDidLoad()
view.backgroundColor = .black
layoutSubviews()
setupAVLayer()
}

override func viewWillAppear(_ animated: Bool) {
setupAVLayer()
super.viewWillAppear(animated)
override func viewDidLayoutSubviews() {
guard let previewLayer else { return }
previewLayer.frame = cameraFrame
previewLayer.position = view.center
viewModel.cameraViewRect = cameraFrame
}

private func layoutSubviews() {
Expand Down

0 comments on commit a6db2cb

Please sign in to comment.