Swift:UIGraphics Drawing on UIView
From Hawk Wiki
Swift: Tutorial Drawing Graphic
Swift:Create Custom UIColor
let swiftColor = UIColor(red: 1, green: 165/255, blue: 0, alpha: 1)
Swift: How to make UIGraphics context background transparent
If you want to set a transparent background of the content you are drawing.
// UIGraphics draw transparent background context @IBOutlet weak var histogramView: HistogramView! override func viewWillAppear(animated: Bool) { histogramView.opaque = false histogramView.backgroundColor = UIColor.clearColor() } class HistogramView: UIView { override func drawRect(rect: CGRect) { // draw content let context = UIGraphicsGetCurrentContext() CGContextClearRect(context, rect) } }