title: Create a dictionary in a loop in Swift
body: <p>I have a variable set of objects that I need to place in a dictionary. I'm trying to add them to the dictionary in a <code>for loop</code> but from what I'm understanding dictionaries are immutable so they need to be declared immediately. How do I create a dictionary list of items that are not predetermined? </p>
  
  <pre><code>var newItems = [:]
  
  for item in self.items{
    newItems["\(item.key)"]["name"] = "A new item" 
  }
  </code></pre>