I am using Alamofire for fetching the images from the webservice. I am showing those image in a custom cell in UICollectionView with the following code
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let reuseIdentifier = "cell"
// get a reference to our storyboard cell
let cell : ImageCollectionCell = collectionView.dequeueReusableCellWithReuseIdentifier("cellCollection", forIndexPath: indexPath) as! ImageCollectionCell
// Use the outlet in our custom class to get a reference to the UILabel in the cell
cell.backgroundColor = UIColor.yellowColor() // make cell more visible in our example project
let imageGalleryURLString = self.MutableArray.objectAtIndex(indexPath.row) .valueForKey("thumbnail") as! String
let imageURL = NSURL(string:imageGalleryURLString)
cell.imageviewCollectionCell.sd_setImageWithURL(imageURL)
return cell
}
But the application crashes at "cell.imageviewCollectionCell.sd_setImageWithURL(imageURL)" showing "fatal error: unexpectedly found nil while unwrapping an Optional value"
I have went through all possible links and i haven't been satisfied yet