Type () cannot conform to ‘View’

Is there any way to just set a private variable to some value within the if change < 0 statement?

private var someVariable = "Change 1"

if let change = viewModel.detail?.change {
    if change < 0 {
        someVariable = "Change 2"
    }

    Text(someVariable)
}

It's currently complaining that "Type '()' cannot conform to'View'"



Read more here: https://stackoverflow.com/questions/64947207/type-cannot-conform-to-view

Content Attribution

This content was originally published by p.dotor at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: