title: Value of protocol type 'Encodable' cannot conform to 'Encodable'; only struct/enum/class types can conform to protocols
body: <p>I have the following Swift code</p>
  <pre><code>func doStuff&lt;T: Encodable&gt;(payload: [String: T]) {
      let jsonData = try! JSONEncoder().encode(payload)
      // Write to file
  }
  
  var things: [String: Encodable] = [
      &quot;Hello&quot;: &quot;World!&quot;,
      &quot;answer&quot;: 42,
  ]
  
  doStuff(payload: things)
  </code></pre>
  <p>results in the error</p>
  <pre><code>Value of protocol type 'Encodable' cannot conform to 'Encodable'; only struct/enum/class types can conform to protocols
  </code></pre>
  <p>How to fix? I guess I need to change the type of <code>things</code>, but I don't know what to.</p>
  <p>Additional info:</p>
  <p>If I change <code>doStuff</code> to not be generic, I simply get the same problem in that function</p>
  <pre><code>func doStuff(payload: [String: Encodable]) {
      let jsonData = try! JSONEncoder().encode(payload) // Problem is now here
      // Write to file
  }
  </code></pre>