title: Swift: assigning function to variable
body: <p>I have a class in swift with the following variable:</p>
  
  <pre><code>var pendingFunction = ((Double, Double) -&gt; Double)
  </code></pre>
  
  <p>Swift then tells me:</p>
  
  <blockquote>
    <p>Expected member name or constructor call after type name</p>
  </blockquote>
  
  <p>It insists that I change my code to:</p>
  
  <pre><code>var pendingFunction = ((Double, Double) -&gt; Double).self
  </code></pre>
  
  <p>I have no clue what this <code>.self</code> thing is doing (sorry I'm new to Swift)</p>
  
  <p>I then try to assign <code>pendingFunction</code> to a new function:</p>
  
  <pre><code>pendingFunction = function
  </code></pre>
  
  <p>where <code>function</code> takes two Doubles and returns a Double.</p>
  
  <p>However, I'm presented with the following error:</p>
  
  <blockquote>
    <p>Cannot assign value of type '(Double,Double) -> Double' to type '((Double,Double)->Double).Type'</p>
  </blockquote>
  
  <p>So my question is: what is the <code>.self</code> thing doing and how can I properly assign a function to the variable?</p>