The code generated by Swagger-codegen for Swift will produce a file, AlamofireImplementations.swift, which will have a number of compile warnings, all of them the same:
Treating a forced downcast to 'T' as optional will never produce 'nil'
There are a few different places that cause this, but here's an example:
completion(response: Response(response: response.response!, body: () as! T), error: nil)
where the warning is on "as!". Seems like an optional cast (as?) would fix these.
Swagger-codegen versionUsing version 2.2.2-SNAPSHOT on master.
Swagger declaration file content or urlI don't have a swagger file to post here, because I can see already that this is invariant to the swagger declaration file. The file in question is mostly pre-defined as is in the template: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/swift/AlamofireImplementations.mustache
The warnings come on lines 172, 187, and 197.
Command line used for generationThis is run from gradle with a custom task I wrote in groovy to call the DefaultGenerator. Again, I don't believe this makes any difference.
Steps to reproduceGenerate a client library for swift and then try to compile that swift.
Related issuesMy searched turned up no related issues.
Suggest a FixI think optional casts in the template file in question would fix it.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4