Skip to content

Debug util to easily pretty-print a human-readable tree structure.

Notifications You must be signed in to change notification settings

jordancoff/DebugTreeConvertible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

DebugTreeConvertible

Debug util to easily pretty-print a human-readable tree structure.

Example

/// Print the visible view hierarchy.
extension UIView: DebugTreeConvertible {
    var header: String {
        "\(Self.self): \(frame)"
    }

    var nestedItems: [DebugTreeConvertible]? {
        subviews.filter(\.isVisible)
    }

    private var isVisible: Bool {
        return !isHidden && frame.height > 0 && frame.width > 0
    }
}

(lldb) po myView.tree

About

Debug util to easily pretty-print a human-readable tree structure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages