 <p>I get no problems when I insert ':String?' right after valueString as shown below:</p> <pre><code>extension Dictionary { func someMethod() -&gt; Bool { for (key, value) in self { if let valueString:String? = value as? String { println(" \(key) = \(valueString)") } else { println(" \(key) = \(value) cannot be cast to `String`") return false } } return true } } func doSomething() { let dictionary: [String: AnyObject?] = ["foo": "bar"] if dictionary.someMethod() { println("no problems") } else { println("casting issues") } } </code></pre>