[Swift]UITextField Extension #1

UITextField Extension #1

func setTintColorToClearButton(){
    let anyobj:AnyObject? = self.valueForKey("_clearButton")
    if let anyobj:AnyObject = anyobj {
        if anyobj.isMemberOfClass(UIButton) {
            let button:UIButton = anyobj as UIButton
            if let image:UIImage = button.imageForState(.Highlighted) {
                let paintedImage:UIImage = image.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
                button.setImage(paintedImage, forState: .Normal)
                button.setImage(paintedImage, forState: .Highlighted)
            }
        }
    }
}