Programming Reference/Librarys
Question & Answer
Q&A is closed
- (instancetype)init
Initializes a newly allocated dictionary.
Return Value - NSDictionary
// ** Init dictionary ** NSDictionary *myDictionary = [[NSDictionary alloc]init]; // ** Output dictionary ** NSLog(@"myDictionary: %@", myDictionary);
If you look at the output for this example code, you`ll see that an empty dictionary was initialized! Because this dictionary is immutable it would make more sense to use a init-method that creates it with some entries or at least one entry. For example initWithObjectsAndKeys.
2014-05-30 20:44:47.577 NSDictionary[720:70b] myDictionary: { }