Moya: How do we handle parameter encodings now in swift 3?

Created on 28 Nov 2016  路  6Comments  路  Source: Moya/Moya

Migrating from Swift 2 to swift 3 produced breaking changes in moya.

How do we handle parameter encodings now in swift 3?

It used to be a switch case sort of away to handle them... is this still present?

Thanks!

question

All 6 comments

Hey @rlam3. We have updated our documentation around the new ParameterEncoding type from Alamofire, please check it here. Hope it helps!

Also, whenever you feel like something isn't clear enough, please let us know so we can improve the docs. 馃憡

@sunshinejr

Is the following way not the accepted way to initialize the endpoint anymore?

        let endpoint: Endpoint<API> = Endpoint<API>(
            URL: target.baseURL.appendingPathComponent(target.path).absoluteString,
            sampleResponseClosure: {.networkResponse(200, target.sampleData)},
            method: target.method,
            parameters: target.parameters,
            parameterEncoding: target.parameterEncoding
        )

The URL parameter should be url.

^ I've updated the documentation to reflect that in #804. Sorry!

@rlam3 it is, it was probably the URL renaming to url as @BasThomas mentioned. Can you try if it works?

@rlam3 it looks like @BasThomas' change should have fixed what you were seeing, please do re-open this if it didn't!

Closing for now 馃槃

Was this page helpful?
0 / 5 - 0 ratings