Append values to [String : AnyObject] or [String : String]
alamofire, dictionary, parameters, swift
Solution
The data type you have mentioned is called `Dictionary`. And Swift dictionary does not provide API `append(_ newElement:)`. Dictionary is a type of hash table. Each entry in the table is identified using its key.
If you want to add new item (key,value), simply add new value under a new key like that:
object["Work"] = "Soldier"
For more information read this doc Dictionary
Problem
I want to append values to a variable of type `[String : AnyObject]` how do I do that? cause I can't do the ff. ``` var someObject:[String : AnyObject] = ["name":"John Diggle", "location":"Star City Prison"] someObject.append(["work":"soldier"]) // does not work (by that I mean there is no .append function like that of other collection types such as NSMutableArray and NSMutableDictionary someObject = someObject + ["work":"soldier"] // does not work ``` I'm finding a way to make easier parameters for Alamofire since Alamofire.request uses `[String : AnyObject]`