Makes source code compatible with Swift 2.3 (#156)
This commit is contained in:
parent
600da97e13
commit
e4315bf4e8
|
|
@ -153,11 +153,11 @@ public extension UIImage {
|
|||
public func bma_tintWithColor(color: UIColor) -> UIImage {
|
||||
let rect = CGRect(origin: CGPoint.zero, size: self.size)
|
||||
UIGraphicsBeginImageContextWithOptions(rect.size, false, self.scale)
|
||||
let context = UIGraphicsGetCurrentContext()
|
||||
let context = UIGraphicsGetCurrentContext()!
|
||||
color.setFill()
|
||||
CGContextFillRect(context, rect)
|
||||
self.drawInRect(rect, blendMode: .DestinationIn, alpha: 1)
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()!
|
||||
UIGraphicsEndImageContext()
|
||||
return image.resizableImageWithCapInsets(self.capInsets)
|
||||
}
|
||||
|
|
@ -165,16 +165,16 @@ public extension UIImage {
|
|||
public func bma_blendWithColor(color: UIColor) -> UIImage {
|
||||
let rect = CGRect(origin: CGPoint.zero, size: self.size)
|
||||
UIGraphicsBeginImageContextWithOptions(rect.size, false, UIScreen.mainScreen().scale)
|
||||
let context = UIGraphicsGetCurrentContext()
|
||||
let context = UIGraphicsGetCurrentContext()!
|
||||
CGContextTranslateCTM(context, 0, rect.height)
|
||||
CGContextScaleCTM(context, 1.0, -1.0)
|
||||
CGContextSetBlendMode(context, .Normal)
|
||||
CGContextDrawImage(context, rect, self.CGImage)
|
||||
CGContextClipToMask(context, rect, self.CGImage)
|
||||
CGContextDrawImage(context, rect, self.CGImage!)
|
||||
CGContextClipToMask(context, rect, self.CGImage!)
|
||||
color.setFill()
|
||||
CGContextAddRect(context, rect)
|
||||
CGContextDrawPath(context, .Fill)
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()!
|
||||
UIGraphicsEndImageContext()
|
||||
return image.resizableImageWithCapInsets(self.capInsets)
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ public extension UIImage {
|
|||
UIGraphicsBeginImageContextWithOptions(size, false, 0)
|
||||
color.setFill()
|
||||
UIRectFill(rect)
|
||||
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()
|
||||
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
|
||||
UIGraphicsEndImageContext()
|
||||
return image
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue