//
// © 2017-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

import UIKit

extension UIView {
	func recursiveDescription(_ view: UIView, indentLevel: Int) -> String {
		let indentStr = String(repeating: "\t", count: indentLevel)
		var output = indentStr + view.debugDescription + "\n"
		if view.subviews.count > 0 {
			view.subviews.forEach { output.append(recursiveDescription($0, indentLevel: indentLevel+1)) }
		}
		return output
	}

	func recursiveDescription() -> String {
		return recursiveDescription(self, indentLevel: 0)
	}
}
