项目在xcode12.4都是没问题的,这次更新后插件出现Swift5.4的提示,然后就重新下载插件编译。其他几个都没问题,Alamofire不能用了。新人,不知道怎么解决,求助各位大哥。
代码贴上:`public struct DataResponse<Success, Failure: Error> {
/// The URL request sent to the server.
public let request: URLRequest?
/// The server's response to the URL request.
public let response: HTTPURLResponse?
/// The data returned by the server.
public let data: Data?
/// The final metrics of the response.
public let metrics: URLSessionTaskMetrics?
/// The time taken to serialize the response.
public let serializationDuration: TimeInterval
/// The result of response serialization.
public let result: Result<Success, Failure>
/// Returns the associated value of the result if it is a success, `nil` otherwise.
public var value: Success? { return result.success }
/// Returns the associated error value if the result if it is a failure, `nil` otherwise.
public var error: Failure? { return result.failure }
/// Creates a `DataResponse` instance with the specified parameters derived from the response serialization.
///
/// - Parameters:
/// - request: The `URLRequest` sent to the server.
/// - response: The `HTTPURLResponse` from the server.
/// - data: The `Data` returned by the server.
/// - metrics: The `URLSessionTaskMetrics` of the `DataRequest` or `UploadRequest`.
/// - serializationDuration: The duration taken by serialization.
/// - result: The `Result` of response serialization.
public init(request: URLRequest?,
response: HTTPURLResponse?,
data: Data?,
metrics: URLSessionTaskMetrics?,
serializationDuration: TimeInterval,
result: Result<Success, Failure>) {
self.request = request
self.response = response
self.data = data
self.metrics = metrics
self.serializationDuration = serializationDuration
self.result = result
}
}项目代码:
protocol NetworkToolDelegate {
//GET 请求
static func makeGetRequest(baseUrl : String ,successHandler: @escaping(_ response:DataResponse<Any>) ->(),errorMsgHandler : @escaping(_ errorMsg : String) ->(),networkFailHandler:@escaping(_ error : Error) -> ())
//POST 请求
static func makePostRequest(baseUrl : String,parameters : [String:Any],successHandler: @escaping(_ response:DataResponse<Any>) ->(),errorMsgHandler : @escaping(_ errorMsg : String) ->(),networkFailHandler:@escaping(_ error : Error) -> ())
/* 图片上传 请求
* imageData : 图片二进制数组
*/
static func upDataIamgeRequest(baseUrl : String,imageArr : [UIImage],successHandler: @escaping(_ response:DataResponse<Any>) ->(),errorMsgHandler : @escaping(_ errorMsg : String) -> (),networkFailHandler: @escaping(_ error:Error) -> ())
}`