Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement EmptyModifier #28

Open
jverkoey opened this issue Aug 2, 2024 · 0 comments
Open

Implement EmptyModifier #28

jverkoey opened this issue Aug 2, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jverkoey
Copy link
Collaborator

jverkoey commented Aug 2, 2024

SwiftUI documentation for the same type: https://developer.apple.com/documentation/swiftui/emptymodifier:

Use the empty modifier to switch modifiers at compile time during development. In the example below, in a debug build the Text view inside ContentView has a yellow background and a red border. A non-debug build reflects the default system, or container supplied appearance.

struct EmphasizedLayout: ViewModifier {
    func body(content: Content) -> some View {
        content
            .background(Color.yellow)
            .border(Color.red)
    }
}


struct ContentView: View {
    var body: some View {
        Text("Hello, World!")
            .modifier(modifier)
    }


    var modifier: some ViewModifier {
        #if DEBUG
            return EmphasizedLayout()
        #else
            return EmptyModifier()
        #endif
    }
}
@jverkoey jverkoey added enhancement New feature or request good first issue Good for newcomers labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant