I am new to Swift and have been trying to write a private enum that matches Equatable. Here is a simplified view of my code:
class Baz { private enum Test: Equatable { case Foo case Bar } private func == (lhs: Test, rhs: Test) -> Bool {
On the method line "==", the compiler complains "Operators are allowed only in the global scope." And when I change the enumeration method and the "==" method for the public, then move the "==" from the class, then the errors will disappear.
My question is, what is the correct way to implement the "==" method for private enumeration?
Any help is appreciated.
========
Edit:
Thanks for helping me. I did not indicate that my personal enumeration and the function above are in the class .. (Code updated)
source share