Alamofire: Closure tuple parameter '(String, String)' does not support destructuring with implicit parameters

Created on 7 Jun 2017  路  6Comments  路  Source: Alamofire/Alamofire

After conversion to Swift 4, getting this error.

screen shot 2017-06-07 at 12 54 50

support

Most helpful comment

components.map { "\($0.0)=\($0.1)" }

use this.
Swift 3 the parameter is flatten, like this

components.map { $0, $1 in
  "\($0)=\($1)"
}

but Swift 4 not.

components.map { $0 in
  "\($0.0)=\($0.1)" // $0 is (String, String)
}

SE-0110

All 6 comments

components.map { "\($0.0)=\($0.1)" }

use this.
Swift 3 the parameter is flatten, like this

components.map { $0, $1 in
  "\($0)=\($1)"
}

but Swift 4 not.

components.map { $0 in
  "\($0.0)=\($0.1)" // $0 is (String, String)
}

SE-0110

@linqingmo Thanks! 馃嵒

@burakgunduztr At the moment we're not supporting Alamofire 4 under Swift 4. You should be able to use Alamofire 4 built using Swift 3.2 in a Swift 4 project. However, if you're using CocoaPods to integrate Alamofire, it likely doesn't handle the distinction yet.

Are you planning to support Swift 4 in the future?

Try this :

return components.map { (componentTuple: (String, String)) in "(componentTuple.0)=(componentTuple.1)"}.joined(separator: "&")

There is now an xcode9 branch up that builds Alamofire 4.5 in a hybrid mode for Swift 3 and 4. Give it a try.

Thanks for the information :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lvandal picture lvandal  路  3Comments

sarbogast picture sarbogast  路  3Comments

yokesharun picture yokesharun  路  3Comments

dpstart picture dpstart  路  3Comments

Tulleb picture Tulleb  路  3Comments