Image Picker in SwiftUI
You need to ask the use permission before access the camera, do this by adding usage key Privacy - Camera Usage Description to your app’s Info.plist together with a purpose string.
SwiftUI Project in XCode 13 there is no Info.plist file in the project navigator. You can still make changes using the Info tab of the target settings.