@angie asks a great question!
probably a stupid question, but here it goes.....
[.... snip ..... ].
does anyone know how to best approach this?
Logic is part of the fun of developing a solution!
Your approach seems to be: take 32 degrees farenheit and convert it to a base value (for example: Schrute Bucks). Then when the user selects a different measurement (Stanley nickels, Kelvin, or centigrade) you'll be ready to convert the base value to the desired measurement. Good thinking!
But then you get an error that throws you off track.
Referencing operator function '==' on 'StringProtocol'
requires that 'Binding<[String]>' conform to 'StringProtocol'
What in rain-drenched Wales does that even mean?
The key here is Binding<String>
.
Two Way Pipe
Think of the dollar sign as a two way pipe to your variable. In one direction you can read the value. In the other direction you can write the value. You need a two way binding in user interface objects like a Picker
. Why? Because you want to display the variable IN the picker, but when your user selects a different option, you want to write that NEW option back to the variable.
See? It's a two way binding.
But in your IF statement, you will NOT be writing to the variable. You only need to read the variable. Consequently, the dollar sign is frivilous, bogus, and completely unnecessary. This is why the compiler complains. I agree with what you're thinking right now. YES, the compiler should just say, "Hey Angie! You don't need the $ in your IF statement."
Keep Coding
Please return here with more questions. Also would like to know how you completed this logic.
Stupid Questions
PS: Many people might say, "There is no such thing as a stupid question!" However, I might counter with "They not met all of my co-workers." (Another Office show reference! (US version))