title: How to add type methods to generic types in Swift?
body: <p>I am trying to add a type (aka static) method to a generic class in Swift. Here is the code.</p>
  
  <pre><code>class StateArchive&lt;T&gt; {
      class func emptyAllArchives() {
          // do something
      }
  }
  
  // the compiler emits an error: "Argument for generic parameter 'T' could not be inferred"
  StateArchive.emptyAllArchives()
  </code></pre>
  
  <p>I can get the above code to compile by providing the type in place of T like so:</p>
  
  <p><code>StateArchive&lt;AnyObject&gt;.emptyAllArchives()</code></p>
  
  <p>This looks awkward, however. Initially I though that the reason for this could be that one could create a class variable with type T. A quick test in the playground revealed that the compiler emits a message saying:</p>
  
  <p>"Class stored properties not yet supported in generic types".</p>
  
  <p>Does anyone know how to create a type method in a generic type and let the client call this method without providing the type in place of T?</p>