From 7f4cfa7f933ea881bd696acd2e384dd2e3d14dd1 Mon Sep 17 00:00:00 2001 From: Reda Lemeden Date: Tue, 25 Nov 2014 01:18:22 +0100 Subject: [PATCH] Resolve strong cycle issues - Closes #3 --- Source/ImageScout.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ImageScout.swift b/Source/ImageScout.swift index 44be54c..5d1c9ca 100644 --- a/Source/ImageScout.swift +++ b/Source/ImageScout.swift @@ -35,7 +35,7 @@ class ImageScout { if let unwrappedURL = NSURL(string: URI) { let operation = ScoutOperation(task: session.dataTaskWithURL(unwrappedURL)) - operation.completionBlock = { + operation.completionBlock = { [unowned self] in completion(operation.error, operation.size, operation.type) self.operations[URI] = nil } @@ -83,7 +83,7 @@ class ImageScout { // MARK: - Delegate private class SessionDelegate: NSObject, NSURLSessionDataDelegate { - var scout: ImageScout? + weak var scout: ImageScout? private func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData data: NSData) { if let unwrappedScout = scout {