*I have these three @State variables:
@State var mhzValue : Float = 0 @State var mhzValueStep : Float = 0 @State var TotalFrequency : Float = 0 And although they mhzValue & mhzValueStep display on in my app..
I wish to add them together..
Example: var TotalFrequency = mhzValue + mhzValueStep
But I just cannot get it to work..
Any suggestions please.. I am a very new to this... Thanks !*
import SwiftUI struct DipoleView : View { @State var mhzValue : Float = 0 @State var mhzValueStep : Float = 0 @State var TotalFrequency : Float = 0 var body: some View { VStack { //Slider one Text("Slide to select Frequency") .font(.headline) .color(.blue) .padding(.leading, -130.0) Slider(value: $mhzValue, from: 1, through: 55, by: 1) .padding(.horizontal) Text("\(Int(mhzValue)) in Mhz") .font(.title) .fontWeight(.semibold) .color(.blue) // Slider Two Text("Slide to select Decimal Point") .font(.headline) .color(.orange) .padding(.leading, -130.0) Slider(value: $mhzValueStep, from: 1, through: 999, by: 0.1) .padding(.horizontal) Text(".\(Int(mhzValueStep)) in Mhz") .font(.title) .fontWeight(.semibold) .color(.orange) Text(" Frequency: \(Int(mhzValue)).\(Int(mhzValueStep)) Mhz") .font(.largeTitle) .fontWeight(.medium) .color(.white) .padding(10) .background(/*@START_MENU_TOKEN@*/Color.blue/*@END_MENU_TOKEN@*/) .cornerRadius(10.0) .shadow(radius: /*@START_MENU_TOKEN@*/10/*@END_MENU_TOKEN@*/) // Load Image View Spacer() ImageView() .padding(.bottom, 40) } } } #if DEBUG struct DipoleView_Previews : PreviewProvider { static var previews: some View { DipoleView() } } #endif