I am making this calculator where one option would be selected for each radio button, the question is how to implement code to perform calculation depending on each option. I ma newbie and was able to finally make these multiple radio buttons on screen that grouped together.
For example, if height is in inches, need to first change height to cams, and considering following code, but unable to
` var heightCms: Double = 0.0
if (heightRadioButtonGroups(callback: heightRadioInchesMajority).isSelected) {
return Double(height) ?? 1 * 2.54
} else {
return Double(height) ?? 1
} */
Though heightRadioInchesMajority is within the code, but getting error that is out of scope.
Would appreciate a simplified solution. In Android Kotlin, it was easy and was able to do it quickly, but here finding difficult and most of online videos are using Ukit or older versions and not much on swiftUI.
In the code shows I used 1 for default value but doesn't matter if it is 0 or 1. I used 1, so that multiplying with zero results in 0 but with 1 will give same value.
Thank
9
0
1.3k