title: How to pass values inputted through a 3 separate text fields on 1 page and show those values in a segmented Controller on a different page? Swift App
body: <p>I am new to Swift so I still have a lot to learn but I am stuck on how I can do this:</p>
  <p>I want to be able to pass values inputted through a 3 separate text fields on 1 page and show those values in a segmented Controller on a different page?</p>
  <p>See the gif for  a visual discription.
  Its the part where the user enters the settings page, changes the default tip amount vals, returns to the mainpage and the segmented controller now displays the updated tip percent values. See Gif for visuals.</p>
  <p><a href="https://media.giphy.com/media/l580imUdTxyeKq8OaB/giphy.gif" rel="nofollow noreferrer">https://media.giphy.com/media/l580imUdTxyeKq8OaB/giphy.gif</a></p>
  <p><a href="https://i.stack.imgur.com/eeiXd.png" rel="nofollow noreferrer">My current app look</a></p>
  <p>Page 1 code:</p>
  <pre><code>//  ViewController.swift
  //  Prework_Intermediate_IOS
  //
  //  Created by Noah Pilkington on 7/26/22.
  //
  
  import UIKit
  
  
  class ViewController: UIViewController {
      
      @IBOutlet weak var billAmountTextField: UITextField!
      @IBOutlet weak var tipAmountLabel: UILabel!
      @IBOutlet weak var tipControl: UISegmentedControl!
      @IBOutlet weak var totalLabel: UILabel!
      
      // party size control
      @IBOutlet weak var PartySizeLabel: UILabel!
      @IBAction func stepper(_ sender: UIStepper)
      {
          PartySizeLabel.text = String(sender.value)
      }
      // end of party size control
      
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view.
      }
      
          // CALCULATE TIP FUNCT
      @IBAction func calculateTip(_ sender: Any) {
          //code here
          // get bill amount from text feild input
          
          let bill = Double(billAmountTextField.text!) ?? 0
          
          // get total tip by multiplying tip * tippercentage
          
          let partysize = Double(PartySizeLabel.text!) ?? 1//declaring partysize
          
          let tipPercentages = [0.15, 0.18, 0.2]
          let tip = bill * tipPercentages[tipControl.selectedSegmentIndex]
          let total = (bill + tip) / partysize
          
          //update tip amount label
          tipAmountLabel.text = String(format: &quot;$%.2f&quot;, tip)
          
          //update total amount
          totalLabel.text = String(format: &quot;$%.2f&quot;, total)
      }
      
  }
  
  </code></pre>
  <p>page 2 Code:</p>
  <pre><code>//
  //  SecondViewController.swift
  //  Prework_Intermediate_IOS
  //
  //  Created by Noah Pilkington on 7/29/22.
  //
  
  import UIKit
  
  class SecondViewController: UIViewController
  {
      //my labels
      @IBOutlet weak var Tip1_Label: UILabel!
      @IBOutlet weak var Tip2_Label: UILabel!
      @IBOutlet weak var Tip3_Label: UILabel!
      
      @IBOutlet weak var tip1Feild: UITextField!
      @IBOutlet weak var tip2Feild: UITextField!
      @IBOutlet weak var tip3Feild: UITextField!
      
      
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Do any additional setup after loading the view.
          
      }
      
    
  
      /*
      // MARK: - Navigation
  
      // In a storyboard-based application, you will often want to do a little preparation before navigation
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          // Get the new view controller using segue.destination.
          // Pass the selected object to the new view controller.
      }
      */
  
  }
  </code></pre>
  <p>Thanks very much!</p>