0
我有一个枚举:检查枚举情况下
enum StoresSortType {
case address, number, lastInspectionDate, distance(CLLocation)
}
我想不带参数只检查的情况下,这样的:
let type = StoresSortType.address
if lastSorting.type == type {
//logic here
}
但我有一个错误:path_to_file.swift:197:69: Binary operator '==' cannot be applied to two 'StoresSortType' operands
在最后一种情况下,我怎么能忽略CLLocation
参数?
你需要做的'StoreSortType'确认为'Equatable'协议。 http://nshipster.com/swift-comparison-protocols/ –