To create a background with a gradient you can use the CAGradientLayer class:
Swift 3.1:
func createGradient() {
let caLayer = CAGradientLayer()
caLayer.colors = [UIColor.white, UIColor.green, UIColor.blue]
caLayer.locations = [0, 0.5, 1]
caLayer.bounds = self.bounds
self...