Casting AnyObject to Dictionary in swift

When you define a Dictionary in Swift you have to give key and value types as well. Something like:

var jsonResult = responseObject as Dictionary<String, AnyObject>

If the cast fails, however, you'll get a runtime error -- you're better off with something like:

if let jsonResult = responseObject as? Dictionary<String, AnyObject> {
    // do whatever with jsonResult
}