title: Swift optional parameter not unwrapped
body: <p>I have a function with a optional parameter(position). I test for it to be nil but still Xcode shows me an error: "Value of optional type Int? not unwrapped" and suggests me to use "!" or "?".</p>
  
  <pre><code>var entries = [String]()
  
  func addEntry(text: String, position: Int?) {
      if(position == nil) {
          entries.append(text)
      } else {
          entries[position] = text
      }
  }
  </code></pre>
  
  <p>Im new to Swift and don't understand why this isn't ok. Within this if-clause the compiler should be 100% sure that position is defined, or?</p>