I am fairly new to Swift and XCode. I have just learnt how to create a gradient on a Navigation Controller from a tutorial video, however in the video I watch the guy used a UIColor and I want to use a CGColor, so I used this code:
class func gradientLayerForBounds(bounds: CGRect) -> CAGradientLayer {
let layer = CAGradientLayer()
let topColor = UIColor(red: 244, green: 45, blue: 78, alpha: 100)
let bottomColor = UIColor(red: 245, green: 67, blue: 58, alpha: 100)
layer.bounds = bounds
layer.colors = [topColor.CGColor, bottomColor.CGColor]
return layer
}
However when I build and run the project, nothing appears, I get no error or warning the Debug box. Hope someone can help me out!