【发布时间】:2015-03-26 12:37:19
【问题描述】:
有没有办法使以下内容真正起作用?
V1-“测试协议不符合Hashable”
protocol testProtocol {
//
}
class test {
var s : Set<testProtocol>?
init(){
}
}
V2 - "Protocol 'testProtocol' 只能用作通用约束,因为它具有 Self 或关联的类型要求
protocol testProtocol : Hashable {
//
}
class test {
var s : Set<testProtocol>?
init(){
}
}
我假设答案是否定的——因为协议(即使带有@objc 标签)没有足够的信息?但也许我在这里缺少某种线或东西。
【问题讨论】: