Baby steps in swift 2: Changing color of objects and backgrounds

Apparently everybody's favourite color isn’t grey so I played around with different ways of modifying color in swift. For this I didn’t do a specific tutorial so instead stack overflow was my most valued help. Love that community!

When “My button” is pushed the following happens
A creeper from Minecraft shows up! (creeper pattern defined by a friend)

Also the label that said “Current color” changed both its text and textcolor. Push “My button” again and the creeper and text changes color again.

The class UIColor is used to define a constant that is called every time the button is pressed, making the creeper change color, that same constant also changes the color of the text for each push of the button. To make the actual text change a constant was created which had the names of the colors used in the same order as the colors in the color constant.

Changing the background color using sliders

Changing the RGB-sliders in the bottom changes the color of the background, the values of the slider (0–1) is passed to a function that with the help of the UIColor class translates the float-numbers to each responding tint of red, green or blue.

Reset is pushed

The reset button makes the creeper its original white color by setting the color of the creeper to the first position in the color constant, that so happens to be is referencing the color white from UIColor. For the next part of this series I’m probably gonna show the code also, as I’m not sure if these explanations make any sense without it.