【发布时间】:2015-08-01 11:11:18
【问题描述】:
字典键需要Hashable 一致性:
class Test {}
var dictionary = [Test: String]() // Type 'Test' dies not conform to protocol 'Hashable'
class Test: NSObject {}
var dictionary = [Test: String]() // Works
如何获取纯 Swift 类实例的地址以用作hashValue?
【问题讨论】:
标签: swift dictionary key hashtable memory-address