Last active
January 17, 2021 13:41
-
-
Save dmytro-anokhin/fb1d0971e406c0b2221a28cc2102ef22 to your computer and use it in GitHub Desktop.
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 UIWindow { | |
/// Print the app's key window hierarchy. | |
class func printKeyWindowHierarchy() { | |
UIApplication.shared.keyWindow?.printHierarchy() | |
} | |
/// Prints the window's view hierarchy. | |
func printHierarchy() { | |
traverseHierarchy { responder, level in | |
print(String(repeating: " ", count: level * 2) + String(describing: responder)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment