Is there a Simple way in Swift to iterate over the attributes of a class.
i.e. i have a class Person, and it has 3 attributes: name, lastname, age.
is there
Here's Swift 5 version of object description:
Swift 5
class TestClass: CustomStringConvertible { public var description: String { return Mirror(reflecting: self).children.compactMap({ if let label = $0.label { return "\(label): \($0.value)" } return "" }).joined(separator: "\n") } }