title: How to NSLog an Optional Int in Swift?
body: <p><code>NSLog</code> is still around in Swift, and offers some extras not available with <code>println</code> such as the timestamp, module, and thread.</p>
  
  <p>However, I'm unsure how to log an optional, for example an optional <code>Int</code>.</p>
  
  <p>Logging an unwrapped optional works fine, e.g.</p>
  
  <pre><code>if let i = myIndex 
  {
     NSLog("%@ i %d", __FUNCTION__, i)
  }
  </code></pre>
  
  <p>Attempting to log <code>myIndex</code>, which I would expect to be an object therefore using format specifier <code>%@</code>;</p>
  
  <pre><code>NSLog("%@ myIndex %@", __FUNCTION__, myIndex)
  </code></pre>
  
  <p>Gives build error:</p>
  
  <pre><code>Value of optional type 'Int?' not unwrapped; did you mean to use '!' or '?'?
  </code></pre>
  
  <p>How can I use <code>NSLog</code> - <strong>not println</strong> - to console out my Optional Int?</p>