Skip to content

Instantly share code, notes, and snippets.

@AlessioAnesa
Created March 10, 2016 13:46
Show Gist options
  • Save AlessioAnesa/eb42fb06c650e98dbffa to your computer and use it in GitHub Desktop.
Save AlessioAnesa/eb42fb06c650e98dbffa to your computer and use it in GitHub Desktop.
Extension for NSView hierarchy description
extension NSView {
func logRecursiveDescription() {
Swift.print(self._recursiveDescription())
}
func _recursiveDescription(depth: Int = 0) -> String
{
var subviewsDescription = ""
for subview in self.subviews {
subviewsDescription += subview._recursiveDescription(depth+1);
}
return "\n" + String(count: depth, repeatedValue: ("\t" as Character)) + self.description + subviewsDescription;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment