 /**
 An UIImageView that retrieves the image from ImageCache (default shared instance).
 */
+@IBDesignable
 public class CachedImageView: QvikImageView {
     private var thumbnailImageView: UIImageView? = nil
+    private var fadeInView: UIView? = nil
     
-    /// Thumbnail image fadeout time in seconds
-    public var thumbnailFadeOutDuration: NSTimeInterval = 0.3
+    /// Duration for fading in the loaded image, in case it is asynchronously loaded.
+    @IBInspectable
+    public var imageFadeInDuration: NSTimeInterval = 0.5
     
     /// JPEG thumbnail data for the image. Should set this before layout cycle.
     public var thumbnailData: NSData? = nil
+    
+    /// Color for a fade-in view; used in case ```thumbnailData``` is not set
+    @IBInspectable
+    public var fadeInColor: UIColor? = nil
     
     /// ImageCache instance to use. Default value is the shared instance.
     public var imageCache = ImageCache.sharedInstance()

    public var imageChangedCallback: (Void -> Void)?
    
    /// Whether to automaticallty respond to image load notification
    public var ignoreLoadNotification = false
    
    override public var image: UIImage? {

                self.image = image
                
                // Fade out the thumbnail view
                UIView.animateWithDuration(imageFadeInDuration, animations: {
                    self.thumbnailImageView?.alpha = 0.0
                    self.fadeInView?.alpha = 0.0
                    }, completion: { finished in
                        self.thumbnailImageView?.removeFromSuperview()
                        self.thumbnailImageView = nil
                        self.fadeInView?.removeFromSuperview()
                        self.fadeInView = nil
                })
            }
        }
