title: Calculator Functionality
body: <p>I’m working on a dilution calculator. I have it 98% working, however, I want it to work a certain way and I’m not sure to do that. This is my first app so I’m new at this.</p>
  <p>So I want the user to be able to input the numbers and hit a button to get the calculation. I’ve been using @State and through my research and understanding, using that instantly updates any changes the user makes.</p>
  <p>So how do I go about making the app wait till the user hits the “Go” button.</p>
  <p>Hers my code so far.</p>
  <pre><code>@State private var ContainerSize = 0
  @State private var DilutionRatio = 0
  @State private var Go = &quot;&quot;
  @State private var TotalProduct = 0.0
  @State private var TotalWater = 0.0
  
  @FocusState private var amountIsFocused: Bool   
  
      var totalProductAmount: Double {       
  
          let firstValue = Double(ContainerSize)
          let secondValue = Double(DilutionRatio + 1)
  
          let totalProduct = Double(firstValue / secondValue)
  
      return totalProduct
  
      }
  
      var totalWaterAmount: Double {
  
          let firstValue = Double(ContainerSize)
          let secondValue = Double(DilutionRatio + 1)
  
          let totalWater = Double(firstValue - secondValue)
  
      return totalWater
  
      }
         
  //Container Size
  
                  ZStack {
                      Image(&quot;Container Size (Oz)&quot;)
                          .padding(.vertical, -15)
                      TextField(&quot;&quot;, value: $ContainerSize, format: .number)
                          .frame(width: 200.0, height: 60.0)
                          .multilineTextAlignment(.center)
                          .font(Font.system(size: 50, design: .default))
                          .keyboardType(.decimalPad)
                          .focused($amountIsFocused)
                  }
              }
  
  //Dilution Ratio
  
              ZStack {
                  Image(&quot;Dilution Ratio - 2&quot;)
                      .padding(.vertical, -10)
                  TextField(&quot;&quot;, value: $DilutionRatio, format: .number)
                      .frame(width: 200.0, height: 60.0)
                      .multilineTextAlignment(.center)
                      .font(Font.system(size: 50, design: .default))
                      .keyboardType(.decimalPad)
                      .focused($amountIsFocused)
              }
  
  //Go Button
  
              Button(action: {}, label: {
                  Image(&quot;Go Button&quot;)
              })
  
  //Results
  
              HStack{            
                  ZStack {
                      Image(&quot;Total Product (Oz)&quot;)
                      Text(&quot;\(totalProductAmount, specifier: &quot;%.1f&quot;)&quot;)
                          .font(Font.system(size: 60, design: .default))
                  }               
  
                  ZStack {
                      Image(&quot;Total Water (Oz)&quot;)
                      Text(totalWaterAmount, format: .number)
                          .font(Font.system(size: 60, design: .default))
                  }
                  .toolbar {
                      ToolbarItemGroup(placement: .keyboard) {
                          Spacer(
                          Button(&quot;Done&quot;) {
                              amountIsFocused = false
      }
  
  }
  
  struct CalculatorIView_Previews: PreviewProvider {
      static var previews: some View {
          CalculatorIView()
  }
  
  }
  </code></pre>
  <p>The calculator works as is but I want the user to input numbers, hit the “Go” button, and the results are shown.</p>