benedom / SwiftyCrop

Crop your images easily using SwiftUI
MIT License
154 stars 31 forks source link

Feature wishlist #23

Open mr-kew opened 1 month ago

mr-kew commented 1 month ago

Hey, I just used this library and it's honestly great. Even lifesaving since Apple does not provide this to developers for some reason.

Here are just a few features/settings I wish that were included:

  1. Fling Allow the image to move outside of the crop, but fling it back on drag end.

  2. Custom button & title labels It's impossible to localize this for every possible language. Allow me to pass my own strings instead, localized or not.

  3. Fixed size mask (aka Allow image to be off screen) Mask always scales so the whole image is visible in the initial state. Allow the mask to stay the same size on screen & have sides of the image outside the screen.

  4. CocoaPods version


Some of those can be addressed by copying the source code & editing it, but it would be nice to have an official support.

benedom commented 1 month ago

Hi @mr-kew, thanks for your ideas!

Here are some of my thougts:

  1. Probably hard to accomplish, I also don't really see the use case. It suggests the user that the cropping area can leave the bounds but then snaps back. Is there a similar cropping tool that uses this functionality?
  2. Easy, I can look into this and add it as a feature.
  3. Probably also a little harder to accomplish. I think this makes sense when cropping profile pictures?
  4. Should be easy to do, altough Cocoapods is to be replaced with SPM.

If you want to tackle one of these wishes yourself, feel free to submit a PR! I am always open for contributions :)

mr-kew commented 1 month ago

@benedom I am generally basing it on the default iOS cropping in contact app, see video (thats kinda what I am going for in my app). Although now that I looked at it again, I find it pretty weird that they allow the image smaller than the crop area.

For the 1. it is really not a big deal, it's just that the native app has it. The 3. is more justified I think. I am using it for profile pictures and I think it would make it more consistent. Anyway it would be great to have that option.

Btw: I am using maskRadius: .infinity and then SwiftyCropView(...).padding(.horizontal, 30). Idk if it was designed this way, but I wanna the crop area to be dependent on the size of the screen, so thats what I did.

I develop in Kotlin Multiplatform, so thats why (well its much more complicated) SPM is not an option for me, so I would appreciate CocoaPods version. It is also a reason why 2. is important for me, because I am using multiplaform localization system and I wanna keep my strings all in one place, so even if the library supported my language I would not use it. Therefore I would like to use the CocoaPods version, but unless I can use my own strings for the buttons & title, I would still have to use the source code version and edit it. I know it's kinda a niche use case, but I wanted to explain where I am coming from with those.

Yeah I might look into some of them in the future. I just figured I might as well write the wishlist here rather than keep it for my future self. Also for now the library is enough for my superiors as is, so I might never get around to implementing some of those things myself as I have other things to focus on right now.

https://github.com/user-attachments/assets/666af1e5-8bd1-48e3-a772-ce1f2b046d64

benedom commented 1 month ago

@mr-kew Thanks for your reply and the example video!

It's a good idea to voice your wishes as it always improves the library for everyone :) I will start looking into issues 2) and 4) ASAP and give you an update once they are available!

benedom commented 1 month ago

@mr-kew the custom texts are now available, I am still working on the cocoapods support