title: How to reference a generic Decodable struct in Swift 4
body: <p>I have a function that I would like to reuse and have it accept a parameter of a Decocable struct.  For example, this is a simplification of my current code (assume "MyDecodableStruct" is a Decodable struct declared elsewhere in the app):</p>
  
  <pre><code> static func getResults(url: String, parameters: Parameters) {
      // On success REST response
       if response.result.isSuccess {
          struct Results: Decodable {
            let items: [MyDecodableStruct]
           }
  
        if let jsonResults = try? JSONDecoder().decode(Results.self, from: response.data!) {
          //success
      }
  }
  </code></pre>
  
  <p>and instead of saying "MyDecodableStruct", I would like it to be any Decodable struct I pass in as a parameter. Something like this:</p>
  
  <pre><code> static func getResults(url: String, parameters: Parameters, myStruct: Decodable) {
      // On success REST response
       if response.result.isSuccess {
          struct Results: Decodable {
            let items: [myStruct]
           }
  
        if let jsonResults = try? JSONDecoder().decode(Results.self, from: response.data!) {
          //success
      }
  }
  </code></pre>
  
  <p>and I would call it like</p>
  
  <pre><code> getResults(url: "url", parameters: nil, myStruct: MyDecodableStruct)
  </code></pre>
  
  <p>I cannot figure out the syntax on how to get this to work though. The errors I get are</p>
  
  <pre><code>Type 'Results' does not conform to protocol 'Decodable'
  Expected element type
  </code></pre>
  
  <p>Any ideas on the best way to handle this?</p>