title: Modify Array in swift using if var =
body: <p>starting swift this past days i'm facing something that looks so simple but this makes me blow my mind. </p>
  
  <p>I have an array myArray which is of type [[String:Any]]. </p>
  
  <p>I want simply want to modify an array by adding stuff in it : </p>
  
  <pre><code>    if var tempValue = self.myArray[0]["values"] as? [AnyObject] {
          tempValue.append("hello")
          // if i print content of self.myArray it is empty
          self.matches[0]["values"] = ["hello", "hello2"]
          // this lines does work
      }
  </code></pre>
  
  <p>i do not understand why when i mutate tempValue the referenced array is not mutated ? Is this a new value ? </p>
  
  <p>Thanks for any explanations. </p>