Skip to content

Instantly share code, notes, and snippets.

@zafarivaev
Created August 8, 2020 10:11
Show Gist options
  • Save zafarivaev/e2d8ccf89e5cf8f72c68d1858f527e12 to your computer and use it in GitHub Desktop.
Save zafarivaev/e2d8ccf89e5cf8f72c68d1858f527e12 to your computer and use it in GitHub Desktop.
extension CustomStringConvertible {
var description: String {
var description = "\n***** \(type(of: self)) *****\n"
let selfMirror = Mirror(reflecting: self)
for child in selfMirror.children {
if let propertyName = child.label {
description += "\(propertyName): \(child.value)\n"
}
}
return description
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment