A modifier to set random background color to debug SwiftUI's View. Random background colors are equal across different executions of your program.
Add .debugRandomBackgroundColor()
to your view.
Remember to delete them, after debugging.
var body: some View {
Text("Hello")
.debugRandomBackgroundColor()
.padding(.vertical, 40.0)
.padding(20.0)
.debugRandomBackgroundColor()
}
Please copy SwiftUIDebugRandomBackgroundColor.swift
and LICENSE file to your Xcode project.
Pull requests are welcomed.
debugRandomBackgroundColor()
takes #file
, #line
, #column
and #function
as default parameter values,
and uses them as PRNG's seeds. This makes background colors equal across different executions.