 
     public override func drawRect(rect: CGRect) {
         
+        #if !TARGET_INTERFACE_BUILDER
+            // this code will run in the app itself
+        #else
+            if pickerImage1 == nil {
+                renderBitmap()
+            }
+        #endif
+        
         if let img = image {
             img.drawInRect(rect)
         }

import UIKit
import ImageIO

public class ColorPicker: UIView {
    
    private class PickerImage {
        var provider:CGDataProvider!

            var alpha:CGFloat = 1
            value.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)
            a = alpha
            if hue != h || pickerImage1 === nil {
                self.h = hue
            }
            currentPoint = CGPointMake(saturation * bounds.width, brightness * bounds.height)
