Better way to manage swift extensions in your project

Image for post
Image for post
Photo by Natalia Y on Unsplash
Image for post
Image for post
let redImage = UIColor.red.toImage()

Problem(s)

Solution(s)

let redImage = UIColor.red.my_toImage()

Swift protocol has got solution for us.

let redImage = UIColor.red.my.toImage()
// extension UIColor: MyHelperCompatible {}

Final Conclusion:

Artist by birth, programmer by choice. 👨🏻‍💻

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store