title: Compare equality of Dictionary in Swift
body: <p>Hi I want to compare two <code>Dictionary</code> of type <code>[AnyHashable : Any]</code> I have gone through a few answers but I do not understand how to achieve the same.</p>
  
  <p>For example the accepted answer on this link
  <a href="https://stackoverflow.com/questions/32365654/how-do-i-compare-two-dictionaries-in-swift">How do I compare two dictionaries in Swift?</a></p>
  
  <p>Where do i write the given method</p>
  
  <pre><code>public func ==&lt;K, V: Hashable&gt;(lhs: [K: V], rhs: [K: V] ) -&gt; Bool {
      return (lhs as NSDictionary).isEqual(to: rhs)
  }
  </code></pre>
  
  <p>I tried declaring it in a <code>Dictionary Extension</code> but it is not helping</p>
  
  <p>Please do not mark this as duplicate I have already given a link to the answer I am trying to follow but it is not helping</p>