How to add field to NSMutableDictionary Swift : <p>Here is what I've tried </p>

<pre><code>var villages = [NSDictionary]()
var bars = [NSMutableDictionary]()
var allBars = [NSMutableDictionary]()

 (bars[2]).setObject(distanceInMiles, forKey: "Distance" as NSCopying)
  //And this
 bars[2]["Distance"] = distanceInMiles
</code></pre>

<p>There is no distance field in my dictionary currently but I'd like to add it to the dictionary and set the value for it. </p>

<p>I keep getting this error:</p>

<p>Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'</p>

<p>Here is how my dictionary is laid out:</p>

<pre><code>[{
Latitude = "40.719629";
Longitude = "-74.003939";
Name = "Macao Trading Co";
ObjectID = ayORtpic7H;
PlaceID = ChIJA9S9jIpZwokRZTF0bHWwXYU;
}, {
Latitude = "40.717304";
Longitude = "-74.008571";
Name = "Bar Cyrk";
ObjectID = z7NV2uOmgH;
PlaceID = ChIJaWlspR9awokRvrKEAoUz3eM;
}, {
Latitude = "40.720721";
Longitude = "-74.005489";
Name = "AOA Bar &amp; Grill";
ObjectID = GIst3BLb5X;
PlaceID = ChIJBYvf3IpZwokRJXbThVSI4jU;
}]
</code></pre>

<p>I'm not sure what I'm doing wrong. My bars dictionary is mutable so why do I keep getting the mutating method sent to immutable object error?</p>
