Skip to content

Commit

Permalink
: hammer: Update main queue return completion
Browse files Browse the repository at this point in the history
  • Loading branch information
noblakit01 committed Jul 16, 2017
1 parent f4cc130 commit 3b31cb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PhotoCollectionView/PhotoCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ open class PhotoCache {
if let workItem = workItems.object(forKey: urlString as NSString) {
workItem.notify(queue: queue, execute: { [weak self] in
if let image = self?.images.object(forKey: urlString as NSString) {
completion(image)
DispatchQueue.main.async {
completion(image)
}
}
})
return
Expand All @@ -47,7 +49,9 @@ open class PhotoCache {
}
}
} catch ( _) {
completion(nil)
DispatchQueue.main.async {
completion(nil)
}
}
}
workItems.setObject(workItem, forKey: urlString as NSString)
Expand Down

0 comments on commit 3b31cb1

Please sign in to comment.