From 0b554deb122b6291d45f415a987821c6b32b0987 Mon Sep 17 00:00:00 2001 From: Zhao Wang Date: Thu, 17 Dec 2015 15:38:42 -0800 Subject: [PATCH] resolve compile warning about variable never read --- Chatto/Source/ChatController/ChatCollectionViewLayout.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Chatto/Source/ChatController/ChatCollectionViewLayout.swift b/Chatto/Source/ChatController/ChatCollectionViewLayout.swift index d6c2219..3a0a811 100644 --- a/Chatto/Source/ChatController/ChatCollectionViewLayout.swift +++ b/Chatto/Source/ChatController/ChatCollectionViewLayout.swift @@ -84,7 +84,10 @@ public class ChatCollectionViewLayout: UICollectionViewLayout { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { () -> Void in // Dealloc of layout with 5000 items take 25 ms on tests on iPhone 4s // This moves dealloc out of main thread - oldLayoutModel = nil + if oldLayoutModel != nil { + // Use nil check above to remove compiler warning: Variable 'oldLayoutModel' was written to, but never read + oldLayoutModel = nil + } } }