diff --git a/BusinessCard/Views/Components/PhotoPickerWithCropper.swift b/BusinessCard/Views/Components/PhotoPickerWithCropper.swift index a15d314..3396e3d 100644 --- a/BusinessCard/Views/Components/PhotoPickerWithCropper.swift +++ b/BusinessCard/Views/Components/PhotoPickerWithCropper.swift @@ -8,9 +8,20 @@ import Bedrock struct PhotoPickerWithCropper: View { @Environment(\.dismiss) private var dismiss + let aspectRatio: CropAspectRatio let onSave: (Data) -> Void let onCancel: () -> Void + init( + aspectRatio: CropAspectRatio = .square, + onSave: @escaping (Data) -> Void, + onCancel: @escaping () -> Void + ) { + self.aspectRatio = aspectRatio + self.onSave = onSave + self.onCancel = onCancel + } + @State private var selectedItem: PhotosPickerItem? @State private var imageData: Data? @State private var showingCropper = false @@ -41,6 +52,7 @@ struct PhotoPickerWithCropper: View { if showingCropper, let imageData { PhotoCropperSheet( imageData: imageData, + aspectRatio: aspectRatio, shouldDismissOnComplete: false ) { croppedData in if let croppedData {