Objective-C: How to create a dictionary?

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
// Empty dictionary stored in dict
NSDictionary *dict = [NSDictionary dictionary];
NSLog(@"value of dict is %@",dict);

return 0;
}
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: @"value", @"key", nil];
NSLog(@"value of dict is %@",dict);

return 0;
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store