title: Timer Countdown using dictionary to retrieve key value // "cannot convert value of type String to expected argument type String"
body: <p>I'm trying to set up an egg timer, and display a countdown when the button is pressed. If "Soft" is pressed, the countdown begins at 300 seconds and so on.</p>
  
  <p>However, this message keeps coming up "cannot convert value of type String to expected argument type String". What should I do?</p>
  
  <p><img src="https://i.stack.imgur.com/yW4CJ.png" alt="Egg Timer code"></p>
  
  <p>and here is the code:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      let eggTimer = ["Soft" : 300, "Medium" : 420, " Hard" : 720]
      var secondsRemaining = 60
  
      @IBAction func hardnessPressed(_ sender: UIButton) {
  
          let hardness = [sender.currentTitle!]
  
          secondsRemaining = eggTimer[hardness]!
          Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(updateTimer), userInfo: nil, repeats: true)
      }
  
      @objc func updateTimer() {
          if secondsRemaining &gt; 0 {
              print(" \(secondsRemaining) second")
              secondsRemaining -= 1
          }
      }
  }
  </code></pre>