title: Appending value-pair to a dictionary-key
body: <p>I am reading a textfile with many sections. I would have a dictionary like:</p>
  
  <pre><code>stringArrayCompleteData['Objekt']['Mobile']    
  stringArrayCompleteData['Objekt']['address']
  stringArrayCompleteData['Header']['devicenumber']
  stringArrayCompleteData['Header']['departmentemailaddresse']
  and much more
  </code></pre>
  
  <p>But in my loob, always the new value would not be appended, the values would be overwritten. And then i have only the last value.</p>
  
  <pre><code>var stringArray = fullImportContent!.componentsSeparatedByString("\n")
  var stringArrayCompleteData = Dictionary&lt;String, Dictionary&lt;String, Any&gt;&gt;()
  var arrIndexSection : String = "NoHeader"
  
          for singleRow in stringArray
          {
              if(singleRow != "")
              {
                  switch singleRow {
                      case "#Header":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Objekt":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Baustelle":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Auftraggeber":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Architekt":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Vermittler":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Regulierer":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Versicherung":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Kontaktstellen":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      case "#Dateien":
                          arrIndexSection = singleRow.stringByReplacingOccurrencesOfString("#", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
                      default:
                          //Here the multiple array would be filled
                          var arrSingleRow = singleRow.componentsSeparatedByString(";")
  
                          if( arrSingleRow.count &gt; 0  )
                          {
                              if( arrIndexSection == "Kontaktstellen" )
                              {
                                  //TODO: Kontaktstellen einlesen
  
                                  //#Kontaktstellen
                                  //Baustelle;0;348873;;;;0
                                  //Baustelle;0;381263;;Albrecht;0815;0
                                  //Regulierer/SV;0;171979;Josef;Eder;08546/911055;0
                                  println( "Kontaktstellendaten" )
                                  println( singleRow )
                              }
                              else if( arrIndexSection == "Dateien" )
                              {
                                  //TODO: Dateien einlesen
  
                                  //#Dateien
                                  //11022015090007_BEmail_INNNUE_21102014141534.pdf; 99; Email an eva.nuhn@mbs-service.de
  
                                  println( "Dateiendaten" )
                                  println( singleRow )
                              }
                              else
                              {
                                  stringArrayCompleteData[arrIndexSection] = [arrSingleRow[0]: arrSingleRow[1]]
  </code></pre>
  
  <p>// Here i tried to update the value and append a value<br>
  //stringArrayCompleteData[arrIndexSection]?.updateValue(arrSingleRow[1], forKey: arrSingleRow[0])
                                      // Error: cannot mutate a constant dictionary</p>
  
  <pre><code>                            }
                          }
                  }
              }
          }
          println( stringArrayCompleteData )
          for key in stringArrayCompleteData.keys {
              println("Key: \(key)")
          }
  </code></pre>
  
  <p>Here are the results of the println()</p>
  
  <blockquote>
    <p>[Auftraggeber: [Telefon2: ], Regulierer: [Telefon2: ], Baustelle: [Telefon2: ], Versicherung: [Telefon2: 01805], Header: [iPadNr:3E24-45B8-A2AC-7E3501BED78A], Objekt: [WeitererHinweis: Test]]</p>
    
    <p>Key: Auftraggeber</p>
    
    <p>Key: Regulierer</p>
    
    <p>Key: Baustelle</p>
    
    <p>Key: Versicherung</p>
    
    <p>Key: Header</p>
    
    <p>Key: Objekt</p>
  </blockquote>