MichaelStoddart
MichaelStoddart

Reputation: 5639

Error using `NSDictionary` in swift

I'm very new to swift and im trying to display a collection of images in collection view

I get an error with this code

let asset: PHAsset = self.photoAsset[indexPath.item] as PHAsset
        PHImageManager.defaultManager().requestImageForAsset(asset, targetSize: PHImageManagerMaximumSize, contentMode: .ScaleAspectFill, options: nil, resultHandler: {
            (result: UIImage!, info: NSDictionary!)in cell.setThumbnailImage(result)

        })

'[NSObject : AnyObject]' is not identical to 'NSDictionary' is the error and I have no idea how to fix it?

Upvotes: 0

Views: 181

Answers (1)

qwerty_so
qwerty_so

Reputation: 36333

The help says

func requestImageForAsset(_ asset: PHAsset!,
           targetSize targetSize: CGSize,
          contentMode contentMode: PHImageContentMode,
              options options: PHImageRequestOptions!,
        resultHandler resultHandler: ((UIImage!,
            [NSObject : AnyObject]!) -> Void)!) -> PHImageRequestID

and you supply

info: NSDictionary!

Change it so you supply

info: [NSObject : AnyObject]!

Upvotes: 1

Related Questions