0

I don't understand the new closure syntax for swift 4.

let asset = self.images[(indexPath as NSIndexPath).item]

let selectedAsset = selectedAssets.enumerated().filter ({ ($0, $1) == asset }).first

This is my code however I'm getting the following error:

Closure tuple parameter '(offset: Int, element: PHAsset)' does not support destructuring with implicit parameters

Could someone please correct my syntax?

EDIT:

I've also tried this

typealias phass = (offset: Int, element: PHAsset)
let selectedAsset = selectedAssets.enumerated().filter ({ phass.element == asset }).first

But it says

Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored

Rick Harrison
  • 33
  • 1
  • 7

0 Answers0