Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension UIImage {
- func resizeToCircleImage(targetSize: CGSize, contentMode: UIViewContentMode) -> UIImage {
- UIGraphicsBeginImageContextWithOptions(targetSize, true, 0.0)
- let rect = CGRect(x: 0, y: 0, width: targetSize.width, height: targetSize.height)
- self.draw(in: rect)
- let newImage = UIGraphicsGetImageFromCurrentImageContext()
- UIGraphicsEndImageContext()
- return newImage!
- }
- }
Add Comment
Please, Sign In to add comment