Add values in NSMutableDictionary in iOS with Objective-C

Viewed 90871

I'm starting objective-c development and I would like to ask the best way to implement a list of keys and values.

In Delphi there is the class TDictionary and I use it like this:

myDictionary : TDictionary<string, Integer>;

bool found = myDictionary.TryGetValue(myWord, currentValue);
if (found)
{
    myDictionary.AddOrSetValue(myWord, currentValue+1);
} 
else
{
    myDictionary.Add(myWord,1);
}

How can I do it in objective-c? Is there equivalent functions to the above mentioned AddOrSetValue() or TryGetValue()?

Thank you.

3 Answers
Related