title: Swift Equatable Protocol
body: <p>I was folling this tutorial for Swift: <a href="https://www.raywenderlich.com/125311/make-game-like-candy-crush-spritekit-swift-part-1" rel="noreferrer">https://www.raywenderlich.com/125311/make-game-like-candy-crush-spritekit-swift-part-1</a> and came across this code:</p>
  <pre><code>func == (lhs: Cookie, rhs: Cookie) -&gt; Bool {
      return lhs.column == rhs.column &amp;&amp; lhs.row == rhs.row
  }
  </code></pre>
  <p>I wrote exactly that, but Xcode is giving my these errors:</p>
  <pre><code>Consecutive declarations on a line must be separated by ';'
  Expected declaration operators are only allowed at global scope
  </code></pre>
  <p>I found this code from apple's documentation: <a href="https://developer.apple.com/documentation/swift/equatable" rel="noreferrer">https://developer.apple.com/documentation/swift/equatable</a></p>
  <p>Which is very similar to what I wrote. Whats wrong? This seems like a bug to me. I am using Xcode 6 Beta 2</p>
  <h3>EDIT:</h3>
  <p>This is my whole Cookie class:</p>
  <pre><code>class Cookie: Printable, Hashable {
      var column: Int
      var row: Int
      let cookieType: CookieType
      let sprite: SKSpriteNode?
      
      init(column: Int, row: Int, cookieType: CookieType) {
          self.column = column
          self.row = row
          self.cookieType = cookieType
      }
      
      var description: String {
          return &quot;type:\(cookieType) square:(\(column),\(row))&quot;
      }
      
      var hashValue: Int {
          return row * 10 + column
      }
      
      func ==(lhs: Cookie, rhs: Cookie) -&gt; Bool {
          return lhs.column == rhs.column &amp;&amp; lhs.row == rhs.row
      }
  }
  </code></pre>