title: Dictionaries [String: [String]] in Swift
body: <p>I have a dictionary that looks like this:</p>
  
  <pre><code>var dict = [String: [String]]()
  </code></pre>
  
  <p>I want to be able to add multiple arrays for a single key. This works fine:</p>
  
  <pre><code>dict["hello"] = ["item 1"]
  </code></pre>
  
  <p>But when I assign a new array the previous value is obviously overwritten - we want to avoid that:</p>
  
  <pre><code>dict["hello"] = ["item 2"] // overwrites item 1 – how to avoid overwriting?
  </code></pre>
  
  <p>So I tried to use the <code>append</code> method, but this returns nil:</p>
  
  <pre><code>dict["hello"]?.append("test") // does nothing? output: ()
  </code></pre>
  
  <p>How can I append strings to the array (value) of a certain key in Swift?</p>