Closed xmanu closed 2 years ago
Thank you for your contributor! I like the idea, but as you say sending back the same error for everything might be awfully confusing – is there a better option here?
One could also pass through the error we got:
public enum ScanError: Error {
case badInput, badOutput, initError(_ error: Error)
}
The user could then decide how to handle it...
I think that seems like a more reasonable solution.
Sorry for getting back to this so late (new 👶😉). I updated the PR to include the discussed changes!
Thank you!
After using this library in my project I found out, that there is currently no way to detect if the user has not granted permissions to the camera. This results in only a black screen for the CodeScannerView.
This PR adds an error case for missing rights, so the developer can update the UI to inform the user about the missing right. This might not be the cleanest implementation as it will always return the missingRights error for every error that occurred during initialization of init of
AVCaptureDeviceInput
. It works well for my case so far and is a purely additive change.Do you mind merging this and releasing a new version @twostraws ? It has been a while since 1.0.7 and quite some new features were added (like viewfinder support)...