Cannot convert value of type 'Int' to expected argument type 'IndexSet'

1.3k Views Asked by At
for number in 0..<fetchResult.count{
    imgManager.requestImage(for: fetchResult.objects(at: number) as! PHAsset, targetSize: CGSize(width:200, height:200), contentMode: .aspectFill, options: requestOptions, resultHandler: {
    image, error in
        self.imageArray.append(image!)
    })
}

I have following error with number in fetchResult.objects(at:number)

cannot convert value of type 'Int' to expected argument type 'IndexSet'

How can I solve this problem?

1

There are 1 best solutions below

0
On
for number in fetchResult{
    imgManager.requestImage(for: number as! PHAsset, targetSize: CGSize(width:200, height:200), contentMode: .aspectFill, options: requestOptions, resultHandler: {
    image, error in
        self.imageArray.append(image!)
    })
}