ios - 通用枚举的 Swift 默认值
问题描述
我有一个像这样的泛型类型的枚举:
public enum ServiceError<FailureResponse: Decodable>: Swift.Error {
case other(Error)
case underlying(statusCode: Int, response: URLResponse)
case decodeError(error: FailureResponse?)
}
我可以将默认类型设置为FailureResponse
?如果我能做到这一点,任何使用我的库的人都不会被迫传递泛型类型
解决方案
推荐阅读
- reactjs - PayuMoney 在 React JS 中的集成
- android - 构建_BodyBuilder时引发了以下StackOverflowError:Firebase.initializeApp()之后的堆栈溢出
- linux - 如何显示子文件夹中的文件数量?
- npm - 在 Gulp 中编译 Less 时出错:`File not found with single glob`
- r - 如何从 R 时间序列图中获取数据?
- python - 未应用 Pandas 逻辑运算
- php - Laravel Broadcast 无法与 Pusher 一起使用
- python - 将 Int 转换为字符串
- sharepoint - 将 SharePoint 列表表单转换为 PowerApp
- python - 字符串比较没有给出预期的结果与识别的语音数据