From 79ce9cbeb93c854e6d44f330b713f2ce05081030 Mon Sep 17 00:00:00 2001 From: GiorgioNatili Date: Fri, 20 Feb 2015 21:11:37 -0500 Subject: [PATCH 1/2] Fix optional unwrap --- .../Giants/ViewController.swift | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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. } - - + + } From be8dcdf40e0ad46650028283415844e3a0847415 Mon Sep 17 00:00:00 2001 From: GiorgioNatili Date: Fri, 20 Feb 2015 21:16:47 -0500 Subject: [PATCH 2/2] Fix core values dealloc --- Creating Class Extensions/Giants/UIImage+Cropping.swift | 2 -- 1 file changed, 2 deletions(-) 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 }