title: Swift AnyObject is not convertible to String/Int
body: <p>I want to parse a JSON to object, but I have no idea how to cast AnyObject to String or Int since I'm getting:</p>
  
  <pre><code>0x106bf1d07:  leaq   0x33130(%rip), %rax       ; "Swift dynamic cast failure"
  </code></pre>
  
  <p>When using for example:</p>
  
  <pre><code>self.id = reminderJSON["id"] as Int
  </code></pre>
  
  <p>I have ResponseParser class and inside of it (responseReminders is an Array of AnyObjects, from AFNetworking responseObject):</p>
  
  <pre><code>for reminder in responseReminders {
      let newReminder = Reminder(reminderJSON: reminder)
          ...
  }
  </code></pre>
  
  <p>Then in Reminder class I'm initialising it like this (reminder as AnyObject, but is Dictionary(String, AnyObject)):</p>
  
  <pre><code>var id: Int
  var receiver: String
  
  init(reminderJSON: AnyObject) {
      self.id = reminderJSON["id"] as Int
      self.receiver = reminderJSON["send_reminder_to"] as String
  }
  </code></pre>
  
  <p><code>println(reminderJSON["id"])</code> result is: Optional(3065522)</p>
  
  <p>How can I downcast AnyObject to String or Int in case like this?</p>
  
  <p>//EDIT</p>
  
  <p>After some tries I come with this solution:</p>
  
  <pre><code>if let id: AnyObject = reminderJSON["id"] { 
      self.id = Int(id as NSNumber) 
  } 
  </code></pre>
  
  <p>for Int and </p>
  
  <pre><code>if let tempReceiver: AnyObject = reminderJSON["send_reminder_to"] { 
      self.id = "\(tempReceiver)" 
  } 
  </code></pre>
  
  <p>for string</p>