IceCubesApp/Packages/DesignSystem/Sources/DesignSystem/UIImage.swift
Thomas Ricouard eb6050a38f Swiftformat
2023-02-12 16:29:41 +01:00

15 lines
407 B
Swift

import UIKit
public extension UIImage {
var roundedImage: UIImage? {
let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: size)
UIGraphicsBeginImageContextWithOptions(size, false, 1)
defer { UIGraphicsEndImageContext() }
UIBezierPath(
roundedRect: rect,
cornerRadius: size.height
).addClip()
draw(in: rect)
return UIGraphicsGetImageFromCurrentImageContext()
}
}