Trying to write this:
if usergavepermissiontousercamera
opencamera
else
showmycustompermissionview
Couldn\'t find a current way to d
You can import the AVFoundation framework and use the authorizationStatus(for:) method shown below and handle the respective cases.
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
}