title: Swift get struct properties from type reference
body: <p>I'm trying to loop over the struct properties but I only have reference for struct type not fully initialized struct. if I were to have an initialized struct I can use the mirror methods but I only have a type reference from generics. </p>
  
  <hr>
  
  <p>Here in my code I'm trying to generate other code for some reason  I'll create function arguments from struct properties. </p>
  
  <pre><code>class LoginRequiredRule&lt;T: Request&gt;: Rule {
  
      var validator: (T) -&gt; Void
      init(validator: @escaping (T) -&gt; Void) {
          self.validator = validator
      }
      let a = T.Type.self
      func generateTree(_ depth: Int, path: String) -&gt; String {
          var o = "";
          // i need to loop over the properities of T here but i only have access to T.self
          return o;
      }
  }
  </code></pre>
  
  <p>I tried using the objc foundation functions to access struct but I don't know objc . 
  Is this even possible in swift runtime?</p>
  
  <p>I know I can implement a protocol that contains static reference to properties but there has to be a swifty way </p>