try catch variable in swift
<p>I am trying to add try catch against variable. Without try catch I this error:</p>

<blockquote>
  <p>fatal error: unexpectedly found nil while unwrapping an Optional value  for variable Double(label.text!)!</p>
</blockquote>

<p>So I want to catch above error. I tried below </p>

<pre><code>do{
    let value = try Double(label.text!)!
    print("value\(value)")
} catch{
    print("hi")
}
</code></pre>

<p>But it still gives same error and I also see this warnings:</p>

<blockquote>
  <p>No calls to throwing functions occur within try and catch block in unreachable...</p>
</blockquote>

<p>Is this right way of using try catch block in swift?</p>

<p>edit: (not duplicate) If I just return <code>return Double(labelDisplay.text)</code> I get compilation error <code>value of option type String? not unwrapped, so I have to use</code>return Double(labelDisplay.text!)!` which is where if fails. That's why I was trying to catch it.</p>

<p>another edit: label is <code>@IBOutlet weak private var label: UILabel!</code></p>

<p>edit: return code </p>

<pre><code>var displayValue: Double{
    get{
        print(labelDisplay.text.dynamicType)
        return Double(labelDisplay.text!)!
    }
    set{
        labelDisplay.text! = String(newValue)
    }
}
</code></pre>