 
 class AnimalDetailViewController: UIViewController {
     
-    var animal:Animal!
-    private var animalPhotos:[Photo]!
+    var animal: Animal!
+    private var animalPhotos: [Photo]!
     
     @IBOutlet weak var animalCenterCircularPhoto: UIImageView!
     @IBOutlet weak var animalBackgroundPhoto: UIImageView!

        
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier(Storyboard.CellIdentifier, forIndexPath: indexPath) as! AnimalPhotoCell
        
        cell.animalImage.image = animalPhotos[indexPath.item].image
        
        return cell
    }

        self.navigationItem.title = animal.getAgeName()
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        
        animalPhotos = animal.getAllImages()
        updateUI()
    }
    
    override func viewDidLayoutSubviews() {
        self.collectionViewHeightConstraint.constant = self.animalPhotoCollection.contentSize.height
    }
    
    func updateUI() {
        self.animalPhotoCollection.reloadData()
        
        dispatch_async(dispatch_get_main_queue()) {
            self.animalCenterCircularPhoto.image = self.animalPhotos.first?.image?.circle
            self.animalCenterCircularPhoto.clipsToBounds = true
            self.animalBackgroundPhoto.image = self.animalPhotos.first?.image
        }
    }
}

