What’s the difference between Camera Roll and Photo Library?

From When should I use UIImagePickerControllerSourceTypePhotoLibrary instead of UIImagePickerControllerSourceTypeSavedPhotosAlbum?: UIImagePickerControllerSourceTypePhotoLibrary references the entire photo library, letting the user choose which album. UIImagePickerControllerSourceTypeSavedPhotosAlbum goes straight to the camera roll album without giving the user a choice as to which album to choose from. They’re similar, but different. You can get to the camera roll from PhotoLibrary, … Read more

iPhone: Camera Preview Overlay

For your implementation file: – (IBAction)TakePicture:(id)sender { // Create image picker controller UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; // Set source to the camera imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; // Delegate is self imagePicker.delegate = self; OverlayView *overlay = [[OverlayView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; // Insert the overlay: imagePicker.cameraOverlayView = overlay; // Allow editing of image … Read more

How to open the ImagePicker in SwiftUI?

You need to wrap UIImagePickerController in a struct implementing UIViewControllerRepresentable. For more about UIViewControllerRepresentable, please check this amazing WWDC 2019 talk: Integrating SwiftUI struct ImagePicker: UIViewControllerRepresentable { @Environment(\.presentationMode) private var presentationMode let sourceType: UIImagePickerController.SourceType let onImagePicked: (UIImage) -> Void final class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { @Binding private var presentationMode: PresentationMode private let sourceType: UIImagePickerController.SourceType … Read more