Swift: How to compare two Dictionary<String, Any> structs?
<p>I'm using the <a href="https://github.com/venmo/Static" rel="nofollow noreferrer"><code>Static</code></a> framework written in Swift that uses <code>typealias Context = [String: Any]</code> for storing additional information for a row.</p>

<p>Now, I need to compare if two <code>Context</code> structs are equal in an <code>extension Row</code>:</p>

<pre><code>public func ==(lhs: Row, rhs: Row) -&gt; Bool {
    // TODO: image, ...
    return lhs.text == rhs.text
        &amp;&amp; lhs.detailText == rhs.detailText
        &amp;&amp; lhs.accessory == rhs.accessory
        &amp;&amp; lhs.context == rhs.context
}
</code></pre>

<p>So I implement the <code>==</code> operator for <code>Row.Context</code>:</p>

<pre><code>public func ==(lhs: Row.Context, rhs: Row.Context) -&gt; Bool {
    return Array(lhs.keys) == Array(rhs.keys)
    // TODO: &amp;&amp; Array(lhs.values) == Array(rhs.values)
}
</code></pre>

<p>but now, in order to <code>lhs.context == rhs.context</code> I need to extend the <code>Row.Context</code> type to conform to <code>Equatable</code>:</p>

<pre><code>extension Row.Context: Equatable {}
</code></pre>

<p>Which is exactly where I'm stuck with the following error:</p>

<blockquote>
  <p>"Constrained extension must be declared on the unspecialized generic
  type 'Dictionary' with constraints specified by a 'where' clause"</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/fuecI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fuecI.png" alt="error - extension Row.Context: Equatable"></a></p>

<p>Ignoring the implementation of <code>func ==</code> for Row.Context for now, <strong>how to make <code>Row.Context</code> conform to <code>Equatable</code>?</strong></p>