I tried to draw a Gradient Dot, but the CGGradientCreateWithColors always returns nil. I am new to Swift and Objective C (started today, but made some Apps with Xamarin). Can please anyone explain what is wrong with the following code?
func initFields(){
var startColor = UIColor.blueColor().CGColor
var endColor = UIColor.greenColor().CGColor
var colors: CFArray = [startColor, endColor]
Gradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), colors, [0, 10])
}
func DrawSomething(){
UIGraphicsBeginImageContext(frame.size)
CGContextDrawRadialGradient(UIGraphicsGetCurrentContext(), Gradient!, TouchLocation!, 10, TouchLocation!, 10, 0)
}