class func imageWithColor(color:UIColor) -> UIImage { let rect = CGRect(x: 0.0,y: 0.0,width: 1.0,height: 1.0) UIGraphicsBeginImageContext(rect.size) let context:CGContext = UIGraphicsGetCurrentContext()! CGContextSetFillColorWithColor(context,color.CGColor); CGContextFillRect(context,rect); let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image }