Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
8829a5a912
commit
fdcb594511
@ -8,9 +8,20 @@ import Bedrock
|
|||||||
struct PhotoPickerWithCropper: View {
|
struct PhotoPickerWithCropper: View {
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
|
let aspectRatio: CropAspectRatio
|
||||||
let onSave: (Data) -> Void
|
let onSave: (Data) -> Void
|
||||||
let onCancel: () -> 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 selectedItem: PhotosPickerItem?
|
||||||
@State private var imageData: Data?
|
@State private var imageData: Data?
|
||||||
@State private var showingCropper = false
|
@State private var showingCropper = false
|
||||||
@ -41,6 +52,7 @@ struct PhotoPickerWithCropper: View {
|
|||||||
if showingCropper, let imageData {
|
if showingCropper, let imageData {
|
||||||
PhotoCropperSheet(
|
PhotoCropperSheet(
|
||||||
imageData: imageData,
|
imageData: imageData,
|
||||||
|
aspectRatio: aspectRatio,
|
||||||
shouldDismissOnComplete: false
|
shouldDismissOnComplete: false
|
||||||
) { croppedData in
|
) { croppedData in
|
||||||
if let croppedData {
|
if let croppedData {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user