title: How can I find the type of a property dynamically in swift (Reflection/Mirror)?
body: <p>So let's say I have a class like this:</p>
  
  <pre><code>class Employee: NSObject {
      var id: String?
      var someArray: [Employee]?
  }
  </code></pre>
  
  <p>I use reflection to get the property names:</p>
  
  <pre><code>let employee = Employee()
  let mirror = Mirror(reflecting: employee)
  propertyNames = mirror.children.flatMap { $0.label } 
  // ["businessUnitId", "someArray"]
  </code></pre>
  
  <p>so far so good! Now i need to be able to figure out the type of each of these properties, so if I do the <code>employee.valueForKey("someArray")</code>, it won't work because it only gives me the AnyObject type. What would be the best way to do this? Specially for the array, I need to be able to dynamically tell that the array contains type of <code>Employee</code>.</p>