Created
March 10, 2016 13:46
-
-
Save AlessioAnesa/eb42fb06c650e98dbffa to your computer and use it in GitHub Desktop.
Extension for NSView hierarchy description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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