Fast Enumeration
suggest changeNSDictionary can be enumerated using fast enumeration, just like other collection types:
NSDictionary *stockSymbolsDictionary = @{
@"AAPL": @"Apple",
@"GOOGL": @"Alphabet",
@"MSFT": @"Microsoft",
@"AMZN": @"Amazon"
};
for (id key in stockSymbolsDictionary)
{
id value = stockSymbolsDictionary[key];
NSLog(@"Key: %@, Value: %@", key, value);
}
Because NSDictionary is inherently unordered, the order of keys in the for-in loop is not guaranteed.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents