'Result<String>' 类型的值没有成员 'error' [Alamofire, Swift 5]

Value of type 'Result<String>' has no member 'error' [Alamofire, Swift 5]

由于 Swift 5 引入了 Result 类型,所以我在使用 Alamofire 时遇到了很多错误。

其他错误:

Enum case 'success' has no associated values
Member 'failure' in 'Result<T>' produces result of type 'Result<String>', but context expects 'Result<T>'

任何快速修复!

改变

Result

Alamofire.Result

或创建一个 typealias 作为,

typealias AFResult = Alamofire.Result

并将 Result 更改为 AFResult