Upvote:4

Aprove answer
override func performGlowAnimations {

    self.colorize(labelArray[a.toInt()!], color:self.green)

    // Delay the second call by 2 seconds
    let delay = 2.0 * Double(NSEC_PER_SEC)
    var time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
    dispatch_after(time, dispatch_get_main_queue(), {
        self.colorize(labelArray[b.toInt()!], color:self.cyan)
    })
}

func colorize(imageView: UIImageView, color: CGColorRef) {

    // Set the image's shadowColor, radius, offset, and
    // set masks to bounds to false
    imageView.layer.shadowColor = color
    imageView.layer.shadowRadius = 7.0
    imageView.layer.shadowOffset = CGSizeZero
    imageView.layer.masksToBounds = false

    // Animate the shadow opacity to "fade it in"
    let shadowAnim = CABasicAnimation()
    shadowAnim.keyPath = "shadowOpacity"
    shadowAnim.fromValue = NSNumber(float: 0.0)
    shadowAnim.toValue = NSNumber(float: 0.9)
    shadowAnim.duration = 2.0

    imageView.layer.addAnimation(shadowAnim, forKey: "shadowOpacity")
    imageView.layer.shadowOpacity = 0.9
}

Credit Goes to: stackoverflow.com

Related question with same questions but different answers