Swift cannot assign value of type '()' to type 'String?'
<p>I'm learning Swift2/iOS app development. I am confused by an error being thrown by Xcode before compiling. Here is the code throwing the error :</p>

<pre><code>let dotpos = display.text!.rangeOfString(".")
if dotpos != nil {
    display.text = display.text!.removeRange(dotpos!)
}
</code></pre>

<p>The error thrown is (at the line "display.text = display.text!.removeRange(dotpos!)") :</p>

<blockquote>
  <p>Cannot assign value of type '()' to type 'String?'</p>
</blockquote>

<p>Note : display is a <code>UILabel</code> object.</p>

<p>Could someone point me toward the error I might have done?</p>