                 }
             }
             DispatchQueue.main.async(execute: { () -> Void in
-                self.photosCache.setObject(thumbImage!, forKey: photoName as NSString)
+                self.photosCache[photoName] = thumbImage
                 cell.photoView.image=thumbImage
             })
             

        let photoName = self.photoList?[(indexPath as NSIndexPath).row] ?? ""
        let photoFilePath = self.photoDirectory()+"/"+photoName
        cell.nameLabel.text = NSString(string: photoName).deletingPathExtension
        var thumbImage = self.photosCache.object(forKey: photoName as NSString)
        cell.photoView.image = thumbImage
        if thumbImage == nil{
           DispatchQueue.global(qos:.userInitiated).async(execute: { () -> Void in

class MKViewController: UICollectionViewController ,UIAdaptivePresentationControllerDelegate{
    var  photoList:[String]?
    fileprivate var  photoOrientation=[PhotoOrientation]()
    fileprivate var  photosCache = [String:UIImage]()
    
    
    func photoDirectory()->String{
