xcode - 有没有办法改变 Xcode 的协议一致性自动完成行为
问题描述
可以说我有协议:
protocol FooProtocol{
func bar<Request: Codable, Response: Codable>()
}
我有课:
class Foo: FooProtocol { //Xcode complains here about protocol conformance with a fix button
}
如果我点击 Xcode 自动完成来修复协议一致性,则会生成以下函数:
class Foo: FooProtocol {
func bar<Request, Response>() where Request : Decodable, Request : Encodable, Response : Decodable, Response : Encodable {
}
}
不是很漂亮。我必须手动重写函数:
func bar<Request: Codable, Response: Codable>()
有没有办法在 Xcode 中改变这种行为?
解决方案
不,所有标准库也都以这种令人发指的方式格式化。
struct Dictionary<Key, Value> where Key : Hashable {
推荐阅读
- android - 为什么新的地方 sdk 客户端兼容性脚本给我 - “访问被拒绝”
- mysql - 将汇总的 SQL 语句
- javascript - 如何处理量角器中发生的错误/异常?
- r - 根据列拆分数据集
- javascript - JavaScript 闭包变量在实例之间共享
- ag-grid - agSetColumnFilter 出现服务器端分页错误
- ruby-on-rails - 用于 nil:NilClass 的 link_thumbnailer 未定义方法“src”
- angular - 在 Angular 6 组件之间共享使用 HTTP GET 加载的数据
- tensorflow - 试图从冻结的 TF 模型中获取 openVino IR
- r - 如何让 R 安装所需的软件包?