'How can AVCaptureDevice device be called in swift
I working in swiftui, swift 5+, Xcode Version 13.2.1. I am trying to programmatically request permission for camera usage using the code below but I keep getting the error
Cannot find 'AVCaptureDevice' in scope
here is my code
struct StartZoomVC: UIViewControllerRepresentable {
....
func askPermissionsForCameraFeed() {
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .authorized: // The user has previously granted access to the camera.
self.setupCaptureSession()
case .notDetermined: // The user has not yet been asked for camera access.
AVCaptureDevice.requestAccess(for: .video) { granted in
if granted {
self.setupCaptureSession()
}
}
case .denied: // The user has previously denied access.
return
case .restricted: // The user can't grant access due to restrictions.
return
}
}
i have researched what could be causing but no answer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
