acevif / SwiftUIDebugRandomBackgroundColor

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:MIT License


Languages

Language:Swift 100.0%