When I was working on my project for Swift Student Challenge, I found an interesting fact regarding camera access. If I create an App project on Xcode, the camera capture works well on it. However, if I copied and pasted the code on an App Playground project on Xcode, it crashed and output several errors. I am wondering why this is happening.
Question about how to access to camera on Swift Playground
Hi there! I believe your issue may be caused by not having the camera capability added / not testing on a real device (are you testing in the simulator?).
Can you confirm that you've added the camera capability in your App Playground in the Signing & Capabilities tab?