After the gloss project for Swift 4 in Xcode 9
I am getting following error which i have no idea
Closure tuple parameter \'(key: _, value: _)
I just encountered this error as a result of using enumerated().map()
:
Closure tuple parameter does not support destructuring
I typed the code:
["foo"].enumerated().map
And then pressed Enter 3 times until Xcode autocompleted the closure boilerplate.
The autocomplete seemingly has a bug that causes the above error. The autocomplete produces double-parenthesis ((offset: Int, element: String))
rather than single-parenthesis (offset: Int, element: String)
.
I fixed it manually and was able to continue:
// Xcode autocomplete suggests:
let fail = ["foo"].enumerated().map { ((offset: Int, element: String)) -> String in
return "ERROR: Closure tuple parameter does not support destructuring"
}
// Works if you manually replace the "(( _ ))" with "( _ )"
let pass = ["foo"].enumerated().map { (offset: Int, element: String) -> String in
return "works"
}
Possibly the result of using Xcode 10.0 beta (10L176w)