Skip to content

DebugFrame is a modifier for SwiftUI view, which is very easy to use and add to any view you want. This modifier adds the overlay with stroke border and CGFrame parameters on your view.

License

Notifications You must be signed in to change notification settings

vdshko/DebugFrame

Repository files navigation

DebugFrame

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.

Integration

Setup with SPM:

DebugFrame or https://github.com/vdshko/DebugFrame

Setup with CocoaPods:

pod 'DebugFrame'

Usage of .debugFrame()

VStack {
  title
    .debugFrame()
  Spacer()
  rectangles
    .debugFrame(color: .black)
  Spacer()
}
.debugFrame(color: .black, .size)

Screenshot of an app using DebugFrame. There are a few colored rectangles, and each one has a dotted line overlay and text showing the width and height.

Usage of .debugBackground()

VStack {
  title
    .debugBackground()
  Spacer()
}
Screenshot of an app using DebugFrame. There is a title text with a randomly colored background rectangle version 1. Screenshot of an app using DebugFrame. There is a title text with a randomly colored background rectangle version 2.

About

DebugFrame is a modifier for SwiftUI view, which is very easy to use and add to any view you want. This modifier adds the overlay with stroke border and CGFrame parameters on your view.

Resources

License

Stars

Watchers

Forks

Packages

No packages published