If i have a struct inside a function, swift keeps telling me is doesn't conform to Comparable, even though the same definition is fine outside of a function -- why is this?
Foo fails Comparable here:
func foo() {
struct Foo : Equatable, Comparable {
let x: Int
let y: Int
static func < (lhs: Foo, rhs: Foo) -> Bool {
return lhs.x+lhs.y < rhs.x+rhs.y
}
}
}
Foo fails Comparable here:
func foo() {
struct Foo : Equatable, Comparable {
let x: Int
let y: Int
static func < (lhs: Foo, rhs: Foo) -> Bool {
return lhs.x+lhs.y < rhs.x+rhs.y
}
}
}