title: How to avoid creating a copy of an array of objects in swift
body: <p>I have a dictionary of arrays that contain one kind of objects : database records.
  Each array is like a table associated to a key (table name) in the dictionary.</p>
  
  <p>My issue is: How do I update a table (delete a record, add a record, etc) without making any temporary copy of the table, like I would do with an NSDictionary of NSArrays ?</p>
  
  <p>Currently, I do :</p>
  
  <pre><code>func addRecord(theRecord: DatabaseRecord, inTable tableName: String)
  {
      if var table = self.database[tableName]
      {
          table.append(theRecord)
          self.database[tableName] = table
      }
      else
      {
          self.database[tableName] = [theRecord];
      }
  }
  </code></pre>
  
  <p>The issue is: a temporary copy of the table is made twice. This is pretty inefficient.</p>