title: Swift reference vs value with arrays and dictionaries
body: <p>In a nutshell, 
  I create an object consisting of an Integer and an Array of Strings.
  I put something into both the integer and the array
  I put the object into a dictionary<br>
  I get a new reference to the object and attempt to append to the array.  This is where it fails</p>
  
  <pre><code>//: Playground - noun: a place where people can play
  
  class IdAndArray {
      var id: Int = 0
      var stringArray:[String] = [String]()
  }
  
  var dict:[Int:IdAndArray] = [Int:IdAndArray]()
  
  var testRec = IdAndArray()
  testRec.id = 1
  testRec.stringArray.append("1 line")
  
  dict[56] = testRec
  
  var ref = (dict[56]?.stringArray)!
  print(ref.count) // 1
  ref.append("2 line")
  
  var anotherRef = (dict[56]?.stringArray)!
  print(anotherRef.count) // 1 instead of 2???
  </code></pre>
  
  <p>I suspect this may be related to this:
  <a href="https://stackoverflow.com/questions/24197186/implementing-a-multimap-in-swift-with-arrays-and-dictionaries">Implementing a multimap in Swift with Arrays and Dictionaries</a></p>
  
  <p>I also suspect it is something to do with optionals but I am forcing the unwrap with the !</p>
  
  <p>For the record, I'm coming from a java background.</p>