Browse Source

code alignment fixed

nayooti 5 years ago
parent
commit
3b3771ccb0
1 changed files with 20 additions and 22 deletions
  1. 20 22
      deltachat-ios/Extensions/UIImage+Extension.swift

+ 20 - 22
deltachat-ios/Extensions/UIImage+Extension.swift

@@ -12,16 +12,15 @@ extension UIImage {
         return self
         return self
     }
     }
 
 
-     func maskWithColor(color: UIColor) -> UIImage? {
-         let maskImage = cgImage!
-
-         let width = size.width
-         let height = size.height
-         let bounds = CGRect(x: 0, y: 0, width: width, height: height)
-
-         let colorSpace = CGColorSpaceCreateDeviceRGB()
-         let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
-         let context = CGContext(
+    func maskWithColor(color: UIColor) -> UIImage? {
+        let maskImage = cgImage!
+
+        let width = size.width
+        let height = size.height
+        let bounds = CGRect(x: 0, y: 0, width: width, height: height)
+        let colorSpace = CGColorSpaceCreateDeviceRGB()
+        let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
+        let context = CGContext(
             data: nil,
             data: nil,
             width: Int(width),
             width: Int(width),
             height: Int(height),
             height: Int(height),
@@ -30,18 +29,17 @@ extension UIImage {
             space: colorSpace,
             space: colorSpace,
             bitmapInfo: bitmapInfo.rawValue
             bitmapInfo: bitmapInfo.rawValue
         )!
         )!
-
-         context.clip(to: bounds, mask: maskImage)
-         context.setFillColor(color.cgColor)
-         context.fill(bounds)
-
-         if let cgImage = context.makeImage() {
-             let coloredImage = UIImage(cgImage: cgImage)
-             return coloredImage
-         } else {
-             return nil
-         }
-     }
+        context.clip(to: bounds, mask: maskImage)
+        context.setFillColor(color.cgColor)
+        context.fill(bounds)
+
+        if let cgImage = context.makeImage() {
+            let coloredImage = UIImage(cgImage: cgImage)
+            return coloredImage
+        } else {
+            return nil
+        }
+    }
 
 
     public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) {
     public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) {
         let rect = CGRect(origin: .zero, size: size)
         let rect = CGRect(origin: .zero, size: size)