I would like to specifically change the UIImage color to any color (excluding the gray borders and lines and preserving the shading effect), using an extension method as shown below:
extension UIImage {
func replaceFillColorTo(_ color: UIColor) {
// what should I do in here?
}
}
I would like the result to be as shown below:

The white shirt is the input and each colored shirt is the output using different colors.






