title: How to add two Ints in Swift 4?
body: <p>I am trying to make an application that allows you to save a number in UserDefaults and then add onto that number later on. Right now, I keep getting the error:</p>
  
  <blockquote>
    <p>'Binary operator '+' cannot be applied to two 'Int?' operands'</p>
  </blockquote>
  
  <p>Can anyone point me in the right direction?</p>
  
  <pre><code>class FirstViewController: UIViewController {
      var totalHoursInt = 0
      var typeHoursInt = 0
      var savedHours = 0
  
      @IBOutlet weak var totalHours: UILabel!
      @IBOutlet weak var typeHours: UITextField!
  
      @IBAction func addButton(_ sender: Any) {
          totalHours.text = typeHours.text!
          UserDefaults.standard.set(typeHours.text, forKey: "savedHours")
          typeHours.text = ""
  
          var totalHoursInt = Int(totalHours.text!)
          var typeHoursInt = Int(typeHours.text!)
  
          print(totalHoursInt + typeHoursInt)
      }
  
      override func viewDidAppear(_ animated: Bool) {
          if let x = UserDefaults.standard.object(forKey: "savedHours") as? String {
              totalHours.text = x
          }
      }
  }
  </code></pre>