title: Check if JSON key is present
body: <p>I have a function downloading JSON. It does it fine however in some cases a object may not contain a certain key. On that occasion it still trys to add a value to the array. I want to make it so if the key is not present then a value of nil is added to the array. Would appreciate it if someone could help. Thanks alot.</p>
  
  <pre><code>if let link = itemDict.value(forKey: "link") {
      if link != nil {
          self.linkArray.append(link as! String)
      }
  }
  </code></pre>