[swift-users] enum compare
tridiak
tridiak at ihug.co.nz
Sat Jan 21 06:56:58 CST 2017
Been searching and trying to figure out a comparison problem.
func ==(lhs : ACType, rhs : ACType) -> Bool {
switch (lhs,rhs) {
case (.other, .other):
return true
case (.other, _):
return false
case (_, .other):
return false
default:
return lhs == rhs
}
}
enum ACType {
case noType
case natural
case armour
case shield
case deflection
case dodge
case sacred
case luck
case other(String)
static func Stacks(type : ACType) -> Bool {
return type == ACType.noType || type == ACType.dodge || type == ACType.other
}
}
I get an error concerning ‘type == ACType.other’.
Compiler blab: Binary operator '==' cannot be applied to operands of type 'ACType' and '(String) -> ACType'
How do I fix this? Simply cannot see it.
TIA Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170122/79047c11/attachment.html>
More information about the swift-users
mailing list