Skip to content

A modifier to set random background color to debug SwiftUI's View. Random background colors are equal across different executions of your program.

License

Notifications You must be signed in to change notification settings

acevif/SwiftUIDebugRandomBackgroundColor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

SwiftUIDebugRandomBackgroundColor

A modifier to set random background color to debug SwiftUI's View. Random background colors are equal across different executions of your program.

Usage

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()
    }

Install

Manual Install

Please copy SwiftUIDebugRandomBackgroundColor.swift and LICENSE file to your Xcode project.

Install Framework

Pull requests are welcomed.

How it works

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.

About

A modifier to set random background color to debug SwiftUI's View. Random background colors are equal across different executions of your program.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages