title: How can I get list of class properties in Swift 4?
body: <pre><code>func getAllPropertyName(_ aClass : AnyClass) -&gt; [String] {
      var count = UInt32()
      let properties = class_copyPropertyList(aClass, &amp;count)
      var propertyNames = [String]()
      let intCount = Int(count)
      for i in 0 ..&lt; intCount {
          let property : objc_property_t = properties![i]!
          guard let propertyName = NSString(utf8String:   property_getName(property)) as? String else {
              debugPrint("Couldn't unwrap property name for \(property)")
              break
          }
          propertyNames.append(propertyName)
      }
      free(properties)
      return propertyNames
  </code></pre>
  
  <p>This code work till Swift 3.2. But I'm using Swift 4 and it's giving me an empty Array[String].</p>