[Swift]UIImageView Extension #1
UIImageView Extension #1
extension UIImageView { var paintColor:String{ get{ return "" } set{ if self.image != nil { if newValue == "" { self.paintByTintColor = false }else{ self.tintColor = Drawer.getUIColorByColorHex(newValue, alpha: 1.0, luminanceScale: 1.0) self.paintByTintColor = true } } } } var paintByTintColor:Bool{ get{ return true } set{ if newValue { self.image = self.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate) }else{ self.image = self.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) } } } }