DebugFrame lib is a simple and powerful tool that can help you build your SwiftUI views easily.
-
Under the hood, it's a modifier that can be applied to any SwiftUI view. It adds an overlay to your view, which displays a border around the view and frame information, such as the view’s origin and size. This can be incredibly helpful when identifying layout issues, such as views that are too large or small or views that are positioned incorrectly.
-
Another feature is a debugBackground extension for the View, with a randomly picked Color each re-render time.
DebugFrame
or https://github.com/vdshko/DebugFrame
pod 'DebugFrame'
VStack {
title
.debugFrame()
Spacer()
rectangles
.debugFrame(color: .black)
Spacer()
}
.debugFrame(color: .black, .size)
VStack {
title
.debugBackground()
Spacer()
}