Table of Contents

init

 
- (instancetype)init
 

Initializes a newly allocated dictionary.

Return Value - NSDictionary

ObjC Sourcecode Example

    // ** 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.

Output for this example code

2014-05-30 20:44:47.577 NSDictionary[720:70b] myDictionary: {
}