diff --git a/LeadKit/.DS_Store b/LeadKit/.DS_Store index 2b1134c4..e29d9bc7 100644 Binary files a/LeadKit/.DS_Store and b/LeadKit/.DS_Store differ diff --git a/LeadKit/LeadKit/Extensions/UIImage/UIImage+Gradients.swift b/LeadKit/LeadKit/Extensions/UIImage/UIImage+Gradients.swift index 78c12d0e..2a95a06f 100644 --- a/LeadKit/LeadKit/Extensions/UIImage/UIImage+Gradients.swift +++ b/LeadKit/LeadKit/Extensions/UIImage/UIImage+Gradients.swift @@ -21,7 +21,7 @@ public extension UIImage { UIGraphicsBeginImageContextWithOptions(size, false, 0) let context = UIGraphicsGetCurrentContext() let colorSpace = CGColorSpaceCreateDeviceRGB() - let colors = gradientColors.map {(color: UIColor) -> AnyObject? in return color.CGColor as AnyObject? } as NSArray + let colors = gradientColors.map { return $0.CGColor } let gradient = CGGradientCreateWithColors(colorSpace, colors, nil) CGContextDrawLinearGradient(context, gradient, @@ -54,7 +54,7 @@ public extension UIImage { CGContextDrawImage(context, rect, CGImage) // Create gradient let colorSpace = CGColorSpaceCreateDeviceRGB() - let colors = gradientColors.map {(color: UIColor) -> AnyObject? in return color.CGColor as AnyObject? } as NSArray + let colors = gradientColors.map { return $0.CGColor } let gradient = CGGradientCreateWithColors(colorSpace, colors, nil) // Apply gradient CGContextClipToMask(context, rect, CGImage) diff --git a/LeadKit/LeadKit/Extensions/UIImage/UIImage+Resize.swift b/LeadKit/LeadKit/Extensions/UIImage/UIImage+Resize.swift index 46fedd49..c0ef7b22 100644 --- a/LeadKit/LeadKit/Extensions/UIImage/UIImage+Resize.swift +++ b/LeadKit/LeadKit/Extensions/UIImage/UIImage+Resize.swift @@ -71,10 +71,12 @@ public extension UIImage { guard let newContext = context else { return nil } - let newImage = UIImage(CGImage: CGBitmapContextCreateImage(newContext), - scale: scale, - orientation: imageOrientation) - return newImage + guard let cgImage = CGBitmapContextCreateImage(newContext) else { + return nil + } + return UIImage(CGImage: cgImage, + scale: scale, + orientation: imageOrientation) } } diff --git a/LeadKit/LeadKit/Extensions/UIImageView/UIImageView+LoadingImage.swift b/LeadKit/LeadKit/Extensions/UIImageView/UIImageView+LoadingImage.swift index 4e1db836..4e950627 100644 --- a/LeadKit/LeadKit/Extensions/UIImageView/UIImageView+LoadingImage.swift +++ b/LeadKit/LeadKit/Extensions/UIImageView/UIImageView+LoadingImage.swift @@ -31,7 +31,7 @@ public extension UIImageView { image = UIImage.imageFromURL(url, placeholder: placeholder, - shouldCacheImage: shouldCacheImage) { [weak self] + cacheImage: shouldCacheImage) { [weak self] (uploadedImage: UIImage?) in guard let image = uploadedImage else {