问题
I am trying to integrate swagger client in my project. I was able to generate classes from swagger. Swagger for swift 3 uses Alamofire for its newtork operations. The issue is one of the generated class name is 'Response'. Alamofire internally has the same class. When i add these classes and try to build I have many errors complaining about re-declaration of class. What can i do in this case? Should i have to change from my server side to not get 'Response' class?
回答1:
You should be able to leave their code alone and just add the module name to your calls:
Alamofire.Response.... Swagger.Response...
so that your code is not ambiguous. (the compiler won't try to guess which one you mean, and you've given it two possibilities... the Module name at the beginning of the class will make it clear to the compiler which one you want.)
来源:https://stackoverflow.com/questions/43230048/adding-two-swift-files-with-same-name-to-project