Skip to content

Instantly share code, notes, and snippets.

@hashaam
Last active August 16, 2020 16:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hashaam/fd352f25f8fee6f5614f1243594d9322 to your computer and use it in GitHub Desktop.
// Youtube: https://www.youtube.com/watch?v=7AlZxClmhPw
// Source: https://hashaam.com/2020/07/30/creating-camera-application-with-avfoundation/
import UIKit
class LaunchViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
}
}
private extension LaunchViewController {
func setupViews() {
addRequestCameraAuthorizationView()
}
func addRequestCameraAuthorizationView() {
let requestCameraAuthorizationView = RequestCameraAuthorizationView()
requestCameraAuthorizationView.translatesAutoresizingMaskIntoConstraints = false
requestCameraAuthorizationView.delegate = self
view.addSubview(requestCameraAuthorizationView)
NSLayoutConstraint.activate([
requestCameraAuthorizationView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
requestCameraAuthorizationView.topAnchor.constraint(equalTo: view.topAnchor),
requestCameraAuthorizationView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
requestCameraAuthorizationView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
}
extension LaunchViewController: RequestCameraAuthorizationViewDelegate {
func requestCameraAuthorizationActionButtonTapped() {
print("request camera authorization button tapped")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment