Skip to content

Instantly share code, notes, and snippets.

@clbemre
Last active March 28, 2020 19:42
Show Gist options
  • Save clbemre/3d61abc8c7f011ab78277a2f29509b4c to your computer and use it in GitHub Desktop.
Save clbemre/3d61abc8c7f011ab78277a2f29509b4c to your computer and use it in GitHub Desktop.
extension CustomStringConvertible {
var description: String {
var desc = "Class Name: \(type(of: self))\n"
let mirror = Mirror(reflecting: self)
for child in mirror.children {
if let label = child.label {
desc.append("\(label): \(child.value)\n")
}
}
return desc
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment