Posts

Post not yet marked as solved
2 Replies
0 Views
Thank you for your answer! I could silence it. I put the rest of codes. Actually, I tried to make the simple app using a camera, but it crashed and I don't know why. If you don't mind, please tell me about that too. struct ImagePicker: UIViewControllerRepresentable{         func makeCoordinator() -> Coordinator {       Coordinator(self)     }          func makeUIViewController(context: Context) ->     UIImagePickerController{         let picker = UIImagePickerController()         picker.sourceType = .camera         picker.delegate = context.coordinator         return picker     }          func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {     } } struct ImagePicker_Previews: PreviewProvider {     static var previews: some View {         ImagePicker()     } } and here is about class Coordinator class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate{     var parent: ImagePicker     init(_ parent: ImagePicker){         self.parent = parent     }  func imagePickerController(_ picker: UIImagePickerController,                            didFinishPickingMediaWithInfo info:                                        [UIImagePickerController.InfoKey: Any]){     let uiImage = info[.originalImage] as! UIImage     UIImageWriteToSavedPhotosAlbum(uiImage, nil, nil, nil) } func imagePickerControllerDidCancel(_ picker: UIImagePickerController){ } } I'd appreciate if you could answer these questions.