I need to get the properties of my class as a dictionary. For simplicity, I created a protocol which has a default implementation as follows:
protocol ListsP
You can simply loop through all the superclassMirrors get the properties. It doesn't matter how many layers there are.
var mirror: Mirror? = Mirror(reflecting: child)
repeat {
for property in mirror!.children {
print("property: \(property)")
}
mirror = mirror?.superclassMirror()
} while mirror != nil