I have an image picker created with PHPicker, and I was wondering if it is possible to let the user scale the chosen image?
This is not the entire code, but just the code for the makeUIViewController which I think is what is needed to solve this problem. I can of course provide the rest of the code if necessary.
func makeUIViewController(context: Context) -> PHPickerViewController {
var config = PHPickerConfiguration(photoLibrary: PHPhotoLibrary.shared())
config.filter = .images
config.selectionLimit = 1
let controller = PHPickerViewController(configuration: config)
controller.delegate = context.coordinator
return controller
}
can use this one line after choose the image to fixed height and width of your image
or here i am sharing my running work with you checkout function
didFinishPicking
andvar body: some View
or if you want to crop via user interface like attach picture
Step 1 Using Xcode 12, go to
File -> Swift Packages -> Add Package
Dependency and enter https://github.com/marshallino16/ImageCropperStep 2
in your
didFinishPicking
method where you are receiving selected image pass it in this package using these linesedited use of ImageCropperView