title: how to pass a Struct type into a func and return a list of that Struct
body: <p>How would I go about defining a function to take a Struct type and returns an array of them?</p>
  
  <p>Rather than repeat the following function for various types of Structs, I'd like to define one function that can accept a parameter defining the type of Struct to use. I've seen Swift generics docs on simple types and classes but I've had trouble applying this to Structs.</p>
  
  <pre><code>func getArray() -&gt; [Thing]? {
      var things = [Thing]()
      let count = … some function …
      if count &gt; 0 {
          for 0..&lt;count {
              let dict = … some other function …
              things.append(Thing(representation:dict))
          }
          return things
      }
      return nil
  }
  </code></pre>