User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

Q&A is closed



- (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: {

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
objective-c/foundation.framework/nsdictionary.h/init.txt · Last modified: 2024/02/16 01:12 (external edit)

Impressum Datenschutz