1

I have the following code snippet.

 camera.onDeviceChange = { [weak self] (camera: LLSimpleCamera!, device: AVCaptureDevice!) -> Void in
      print("Device changed.")
 }

This used to work fine in Swift 2, but now I am getting the following error message:

Cannot assign value of type '(LLSimpleCamera!, AVCaptureDevice!) -> Void' to type '((LLSimpleCamera?, AVCaptureDevice?) -> Void)!'

Not really sure how to change this, I tried matching the type by changing the ! to optionals and then adding ! after the void, however this didn't work.

Bhavin Bhadani
  • 22,224
  • 10
  • 78
  • 108
Alk
  • 5,215
  • 8
  • 47
  • 116

1 Answers1

1

Your error suggest type mismatch that means LLSimpleCamera! != LLSimpleCamera? .. there is no need to define type. .. you can use it something like

camera.onDeviceChange = { [weak self] (camera, device) -> Void in
   print("Device changed.")
}
Bhavin Bhadani
  • 22,224
  • 10
  • 78
  • 108