29 Nov 2017

How to add two NSDictionaries into NSMutableDictionary Objective C...


The below code is an example of Adding Two Dictionaries into a Single mutableDictionary ,


  NSDictionary *dict1= [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"One",@"2",@"Two",@"3",@"Three",@"4",@"Four"nil];
    NSDictionary *dict2 = [NSDictionary dictionaryWithObjectsAndKeys:@"5",@"Five",@"6",@"Six",@"7",@"Seven",@"8",@"Eight",nil];
    NSMutableDictionary *dictMerged  = [NSMutableDictionary dictionaryWithDictionary: dict1];
    [dictMerged addEntriesFromDictionary: dict2];
    
    NSLog(@"dictMerged===> %@",dictMerged);


/*
 Result: dictMerged===> {
Eight = 8;
Five = 5;
Four = 4;
One = 1;
Seven = 7;
Six = 6;
Three = 3;
Two = 2;
}
 */






1 comment:

  1. Woori Casino - Tuto4ps
    Woori Casino 더킹 vip 카지노 has been on the gaming circuit for over a decade now. It is a brand new 우리 카지노 먹튀 online casino brand that can be considered to be 마리나 베이 샌즈 카지노 one 온카지노 of the 메리트 카지노 가입 쿠폰

    ReplyDelete

Recent Posts

Codable demo

Link: https://www.dropbox.com/s/kw7c1kgv1628bh7/codableDemo.zip?dl=0