Deepak Thakur
Deepak Thakur

Reputation: 3691

Cannot assign value of type '(UIImage?, PHAsset?)' to type UIImage? Swift 2.2

I updated to XCode 7.3 - swift 2.2 and I received a compile time error as mentioned in the title. It had no issues in swift 2.1. As per basics of swift, '?' variables can be compared to nil. I googled for possible solutions, but could not find the appropriate solution. enter image description here

Upvotes: 0

Views: 505

Answers (1)

Peter K
Peter K

Reputation: 438

I think the problem was not in swift update but in ALCameraViewController update. Now it takes completion with two parameters

public typealias CameraViewCompletion = (UIImage?, PHAsset?) -> Void

So you need to change this

(image) -> Void in ...

to this

(image, asset) -> Void in ...

Actually now in your code Swift treats image as tuple of two values so also you can change all calls to image in your code with calls to image.0 that will address first closure parameter that is your UIImage?

Upvotes: 2

Related Questions