I have a requirement to create colourful string where each letter should have multicolors / rainbow colors. Refer the attached image for better understanding. This need to create using Swift 5+ (UIKit) coding for an iOS app’s dashboard.
In web, there are multiple solutions for multicolored string, but each letter of the string contain single color only, therefore they won’t served my purpose. Any suggestions must be appreciated.
3
Answers
With the help of Zeeshan Ahmed and Shadowrun, I able to solve my problem. My final solution is,
And the expected output should be, Gradient single letter
Kudos to all.
The steps are: make a
CAGradientLayer
, then: