mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
32 lines
801 B
Swift
32 lines
801 B
Swift
import UIKit
|
|
|
|
public func dumpViews(view: UIView) {
|
|
dumpViews(view, indent: "")
|
|
}
|
|
|
|
private func dumpViews(view: UIView, indent: String = "") {
|
|
print("\(indent)\(view)")
|
|
let nextIndent = indent + "-"
|
|
for subview in view.subviews {
|
|
dumpViews(subview as UIView, indent: nextIndent)
|
|
}
|
|
}
|
|
|
|
public func dumpLayers(layer: CALayer) {
|
|
dumpLayers(layer, indent: "")
|
|
}
|
|
|
|
private func dumpLayers(layer: CALayer, indent: String = "") {
|
|
print("\(indent)\(layer)(\(layer.frame))")
|
|
if layer.sublayers != nil {
|
|
let nextIndent = indent + ".."
|
|
for sublayer in layer.sublayers ?? [] {
|
|
dumpLayers(sublayer as CALayer, indent: nextIndent)
|
|
}
|
|
}
|
|
}
|
|
|
|
public func floorToScreenPixels(value: CGFloat) -> CGFloat {
|
|
return floor(value * 2.0) / 2.0
|
|
}
|