diff --git a/Creating Class Extensions/Giants/UIImage+Cropping.swift b/Creating Class Extensions/Giants/UIImage+Cropping.swift index 54d6f47..f34323e 100644 --- a/Creating Class Extensions/Giants/UIImage+Cropping.swift +++ b/Creating Class Extensions/Giants/UIImage+Cropping.swift @@ -29,8 +29,6 @@ extension UIImage { let newImage = UIGraphicsGetImageFromCurrentImageContext() - CGContextRelease(context) - return newImage } diff --git a/Creating Class Extensions/Giants/ViewController.swift b/Creating Class Extensions/Giants/ViewController.swift index e4ef5c4..2f4c6aa 100644 --- a/Creating Class Extensions/Giants/ViewController.swift +++ b/Creating Class Extensions/Giants/ViewController.swift @@ -9,21 +9,25 @@ import UIKit class ViewController: UIViewController { - - @IBOutlet var imageView : UIImageView = nil + + @IBOutlet var imageView:UIImageView? override func viewDidLoad() { super.viewDidLoad() - let img = imageView.image - imageView.image = img.cropToCircleWithBorderColor(UIColor(red:0.91, green:0.34, blue:0.16, alpha:1.00), lineWidth: 20) + if let img = imageView?.image{ + + imageView!.image = img.cropToCircleWithBorderColor(UIColor(red:0.91, green:0.34, blue:0.16, alpha:1.00), lineWidth: 20) + + } + } - + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } - - + + }