Print properties of object in Swift
Reference: StackOverflow – Print Struct name in swift Here’s the code for printing the properties of an object func printProperties(_ object: Any) { var properties = [String: Any]() Mirror(reflecting: object).children.forEach { (child) in if let property = child.label { properties[property] = child.value } } print(object) print(type(of: object)) print(properties) } How the output would look like …