我有一个新项目,其中所有REST代码都是由swagger-codegen生成的,我之前从未使用过。除了requestBuilder初始化错误之外,一切似乎都能正常工作
Cannot convert value of type 'RequestBuilder<_>.Type' to specified type 'RequestBuilder<MyGeneratedModel>.Type'
请求构建器:
let requestBuilder: RequestBuilder<TimeoutForNextRequestInSeconds>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
requestBuilderFactory:
open static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
AlamofireRequestBuilderFactory:
class AlamofireRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return AlamofireRequestBuilder<T>.self
}
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type {
return AlamofireDecodableRequestBuilder<T>.self
}
}
public protocol RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
}
有什么猜测它会是什么?