Parse platform UICollectionView在滚动时速度非常慢

Parse platform UICollectionView在滚动时速度非常慢,parse-platform,uicollectionview,uicollectionviewcell,Parse Platform,Uicollectionview,Uicollectionviewcell,因此,我收集了一些代码,可以下载图像并将它们显示在我创建的自定义UICollectionViewCell上,但是滚动速度非常慢。是否应该将下面函数中的代码移动到一个NSObject类中,以便以某种方式为我下载?我完全不知道该怎么做才能加快速度 先谢谢你!:) 使用它将负责异步下载/查看 func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) ->

因此,我收集了一些代码,可以下载图像并将它们显示在我创建的自定义UICollectionViewCell上,但是滚动速度非常慢。是否应该将下面函数中的代码移动到一个NSObject类中,以便以某种方式为我下载?我完全不知道该怎么做才能加快速度

先谢谢你!:)

使用它将负责异步下载/查看

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as HomeCollectionViewCell
    cell.backgroundColor = UIColor.lightGrayColor()


    var post:PFObject = self.posts.objectAtIndex(indexPath.row) as PFObject
    var imageFile:PFFile = post.objectForKey("file") as PFFile
    var imageFileURL:NSURL = NSURL(string: imageFile.url)!
    var imageData:NSData = NSData(contentsOfURL: imageFileURL)!

    cell.imageView.image = UIImage(data: imageData)

    return cell

}