Use .hueRotation To Colour Shift Using An Angle
Daily Coding Tip 178
With hue rotation every colour will be shifted the same amount, depending on where it was on the colour wheel.
First I need a View extension that will allow me to do three modifiers at once.
I’ve also created 3 gradients.
Apple’s example code for this uses a gradient of three colours, mainly to show that multiple colours change at once. I wanted to make their example code more interactive so I made it possible to choose a hue rotation angle between 0 and 360, and I added a Button that animates the value.
Now you can see why I saved a lot of repetition by creating the .sizeAndRotation modifier.




